diff --git a/cloze.classes.inc b/cloze.classes.inc
index 9ea620f..ab2ff14 100644
--- a/cloze.classes.inc
+++ b/cloze.classes.inc
@@ -252,7 +252,7 @@ class ClozeQuestion extends QuizQuestion {
       return $this->getMaximumScore();
     }
     foreach ($correct_answer as $key => $value) {
-      if (drupal_strtolower($correct_answer[$key]) == drupal_strtolower($user_answer[$key])) {
+      if (_cloze_get_clean_text($correct_answer[$key]) == _cloze_get_clean_text($user_answer[$key])) {
         $correct_answer_count++;
       }
     }
@@ -278,9 +278,9 @@ class ClozeResponse extends QuizQuestionResponse {
     if (!isset($answer)) {
       $r = db_query("SELECT answer_id, answer, score, question_vid, question_nid, result_id FROM {quiz_cloze_user_answers} WHERE question_nid = :question_nid AND question_vid = :question_vid AND result_id = :result_id", array(':question_nid' => $question_node->nid, ':question_vid'=>$question_node->vid, ':result_id' => $result_id))->fetch();
       if (!empty($r)) {
-	$this->answer = unserialize($r->answer);
-	$this->score = $r->score;
-	$this->answer_id = $r->answer_id;
+        $this->answer = unserialize($r->answer);
+        $this->score = $r->score;
+        $this->answer_id = $r->answer_id;
       }
     }
     else {
@@ -360,7 +360,7 @@ class ClozeResponse extends QuizQuestionResponse {
     );
     foreach (_cloze_get_question_chunks($question) as $position => $chunk) {
       if (strpos($chunk, '[') === FALSE) {
-        // this "tries[foobar]" hack is needed becaues question handler engine checks for input field
+        // this "tries[foobar]" hack is needed becaues response handler engine checks for input field
         // with name tries
         $question_form['tries['. $position .']'] = array(
           '#markup' => str_replace("\n", "<br/>", $chunk),
diff --git a/cloze.module b/cloze.module
index d1003c1..55fc4d4 100644
--- a/cloze.module
+++ b/cloze.module
@@ -166,7 +166,7 @@ function _cloze_get_user_answer($question, $answer) {
   $correct_answer_chunks = _cloze_get_correct_answer_chunks($question);
   foreach ($chunks as $key => $value) {
     if (isset($answer[$key]) && !empty($answer[$key])) {
-      $class = (drupal_strtolower($correct_answer_chunks[$key]) == drupal_strtolower($answer[$key])) ? 'correct' : 'incorrect';
+      $class = (_cloze_get_clean_text($correct_answer_chunks[$key]) == _cloze_get_clean_text($answer[$key])) ? 'correct' : 'incorrect';
       $class .= ' answer user-answer';
       $user_answer[$key] = '<span class="'. $class .'">' . $answer[$key] . '</span>';
     }
@@ -177,3 +177,12 @@ function _cloze_get_user_answer($question, $answer) {
   $output = implode(' ', $user_answer);
   return str_replace("\n", "<br/>", $output);
 }
+
+/**
+ * Makes the given text consistent for comparison
+ */
+function _cloze_get_clean_text($text) {
+  $text = trim($text);
+  $text = drupal_strtolower($text);
+  return $text;
+}
