Index: trunk/engines/google.go
===================================================================
--- trunk/engines/google.go	(revision 21)
+++ trunk/engines/google.go	(revision 22)
@@ -121,4 +121,6 @@
 	doc, err := goquery.NewDocumentFromReader(response.Body)
 
+	translatedText := doc.Find(".result-container").Text()
+
 	if err != nil {
 		return TranslationResult{}, err
@@ -165,103 +167,105 @@
 		return TranslationResult{}, nil
 	}
-
-	data := raw[0].([]interface{})[2].(string)
-
-	var json_ []interface{}
-	err = json.Unmarshal([]byte(data), &json_)
-
 	definitions := make(map[string][]map[string]interface{})
-
-	if len(json_) > 3 && json_[3] != nil &&
-		len(json_[3].([]interface{})) > 1 && json_[3].([]interface{})[1] != nil &&
-		len(json_[3].([]interface{})[1].([]interface{})) > 0 && json_[3].([]interface{})[1].([]interface{})[0] != nil {
-		for x := 0; x < len(json_[3].([]interface{})[1].([]interface{})[0].([]interface{})); x++ {
-			if len(json_[3].([]interface{})[1].([]interface{})[0].([]interface{})[x].([]interface{})) > 0 {
-				definitionType := json_[3].([]interface{})[1].([]interface{})[0].([]interface{})[x].([]interface{})[0]
-				if definitionType == nil {
-					definitionType = "unknown"
-				}
-
-				definitions[definitionType.(string)] = []map[string]interface{}{}
-
-				for i := 0; i < len(json_[3].([]interface{})[1].([]interface{})[0].([]interface{})[x].([]interface{})[1].([]interface{})); i++ {
-					definitionBox := json_[3].([]interface{})[1].([]interface{})[0].([]interface{})[x].([]interface{})[1].([]interface{})[i].([]interface{})
-					definitions[definitionType.(string)] = append(definitions[definitionType.(string)], map[string]interface{}{})
-
-					if len(definitionBox) > 4 && definitionBox[4] != nil &&
-						len(definitionBox[4].([]interface{})) > 0 && definitionBox[4].([]interface{})[0] != nil &&
-						len(definitionBox[4].([]interface{})[0].([]interface{})) > 0 && definitionBox[4].([]interface{})[0].([]interface{})[0] != nil {
-						definitions[definitionType.(string)][i]["dictionary"] = definitionBox[4].([]interface{})[0].([]interface{})[0]
-					}
-
-					if len(definitionBox) > 0 && definitionBox[0] != nil {
-						definitions[definitionType.(string)][i]["definition"] = definitionBox[0]
-					}
-
-					if len(definitionBox) > 1 && definitionBox[1] != nil {
-						definitions[definitionType.(string)][i]["use-in-sentence"] = definitionBox[1]
-					}
-
-					if len(definitionBox) > 5 && definitionBox[5] != nil {
-						definitions[definitionType.(string)][i]["synonyms"] = map[string][]string{}
-						synonyms := definitionBox[5].([]interface{})
-						synonymsMap := make(map[string][]string)
-
-						for _, synonymBox := range synonyms {
-							synonymType := ""
-							if len(synonymBox.([]interface{})) > 1 && synonymBox.([]interface{})[1] != nil &&
-								len(synonymBox.([]interface{})[1].([]interface{})) > 0 && synonymBox.([]interface{})[1].([]interface{})[0] != nil {
-								synonymType = synonymBox.([]interface{})[1].([]interface{})[0].([]interface{})[0].(string)
-							}
-
-							if len(synonymBox.([]interface{})) > 0 && synonymBox.([]interface{})[0] != nil {
-								synonymList := synonymBox.([]interface{})[0].([]interface{})
-								synonymsMap[synonymType] = []string{}
-								for _, synonymTypeWord := range synonymList {
-									synonymsMap[synonymType] = append(synonymsMap[synonymType], synonymTypeWord.([]interface{})[0].(string))
+	translations := make(map[string]map[string]map[string]interface{})
+
+	if len(raw) > 0 && raw[0] != nil &&
+		len(raw[0].([]interface{})) > 2 && raw[0].([]interface{})[2] != nil {
+		data := raw[0].([]interface{})[2].(string)
+
+		var json_ []interface{}
+		err = json.Unmarshal([]byte(data), &json_)
+
+		if len(json_) > 3 && json_[3] != nil &&
+			len(json_[3].([]interface{})) > 1 && json_[3].([]interface{})[1] != nil &&
+			len(json_[3].([]interface{})[1].([]interface{})) > 0 && json_[3].([]interface{})[1].([]interface{})[0] != nil {
+			for x := 0; x < len(json_[3].([]interface{})[1].([]interface{})[0].([]interface{})); x++ {
+				if len(json_[3].([]interface{})[1].([]interface{})[0].([]interface{})[x].([]interface{})) > 0 {
+					definitionType := json_[3].([]interface{})[1].([]interface{})[0].([]interface{})[x].([]interface{})[0]
+					if definitionType == nil {
+						definitionType = "unknown"
+					}
+
+					definitions[definitionType.(string)] = []map[string]interface{}{}
+
+					for i := 0; i < len(json_[3].([]interface{})[1].([]interface{})[0].([]interface{})[x].([]interface{})[1].([]interface{})); i++ {
+						definitionBox := json_[3].([]interface{})[1].([]interface{})[0].([]interface{})[x].([]interface{})[1].([]interface{})[i].([]interface{})
+						definitions[definitionType.(string)] = append(definitions[definitionType.(string)], map[string]interface{}{})
+
+						if len(definitionBox) > 4 && definitionBox[4] != nil &&
+							len(definitionBox[4].([]interface{})) > 0 && definitionBox[4].([]interface{})[0] != nil &&
+							len(definitionBox[4].([]interface{})[0].([]interface{})) > 0 && definitionBox[4].([]interface{})[0].([]interface{})[0] != nil {
+							definitions[definitionType.(string)][i]["dictionary"] = definitionBox[4].([]interface{})[0].([]interface{})[0]
+						}
+
+						if len(definitionBox) > 0 && definitionBox[0] != nil {
+							definitions[definitionType.(string)][i]["definition"] = definitionBox[0]
+						}
+
+						if len(definitionBox) > 1 && definitionBox[1] != nil {
+							definitions[definitionType.(string)][i]["use_in_sentence"] = definitionBox[1]
+						}
+
+						if len(definitionBox) > 5 && definitionBox[5] != nil {
+							definitions[definitionType.(string)][i]["synonyms"] = map[string][]string{}
+							synonyms := definitionBox[5].([]interface{})
+							synonymsMap := make(map[string][]string)
+
+							for _, synonymBox := range synonyms {
+								synonymType := ""
+								if len(synonymBox.([]interface{})) > 1 && synonymBox.([]interface{})[1] != nil &&
+									len(synonymBox.([]interface{})[1].([]interface{})) > 0 && synonymBox.([]interface{})[1].([]interface{})[0] != nil {
+									synonymType = synonymBox.([]interface{})[1].([]interface{})[0].([]interface{})[0].(string)
+								}
+
+								if len(synonymBox.([]interface{})) > 0 && synonymBox.([]interface{})[0] != nil {
+									synonymList := synonymBox.([]interface{})[0].([]interface{})
+									synonymsMap[synonymType] = []string{}
+									for _, synonymTypeWord := range synonymList {
+										synonymsMap[synonymType] = append(synonymsMap[synonymType], synonymTypeWord.([]interface{})[0].(string))
+									}
 								}
 							}
-						}
-
-						definitions[definitionType.(string)][i]["synonyms"] = synonymsMap
+
+							definitions[definitionType.(string)][i]["synonyms"] = synonymsMap
+						}
 					}
 				}
 			}
 		}
-	}
-
-	translations := make(map[string]map[string]map[string]interface{})
-	if len(json_) > 3 && json_[3] != nil &&
-		len(json_[3].([]interface{})) > 5 && json_[3].([]interface{})[5] != nil &&
-		len(json_[3].([]interface{})[5].([]interface{})) > 0 && json_[3].([]interface{})[5].([]interface{})[0] != nil {
-		translationBox := json_[3].([]interface{})[5].([]interface{})[0].([]interface{})
-		for x := 0; x < len(translationBox); x++ {
-			if len(translationBox[x].([]interface{})) > 0 {
-				translationType := translationBox[x].([]interface{})[0]
-				if translationType == nil {
-					translationType = "unknown"
-				}
-				translations[translationType.(string)] = make(map[string]map[string]interface{})
-
-				if len(translationBox[x].([]interface{})) > 1 && translationBox[x].([]interface{})[1] != nil {
-					translationNamesBox := translationBox[x].([]interface{})[1].([]interface{})
-					for i := 0; i < len(translationNamesBox); i++ {
-						if len(translationNamesBox[i].([]interface{})) > 0 && translationNamesBox[i].([]interface{})[0] != nil {
-							translationName := translationNamesBox[i].([]interface{})[0].(string)
-							translations[translationType.(string)][translationName] = make(map[string]interface{})
-							if len(translationNamesBox[i].([]interface{})) > 3 && translationNamesBox[i].([]interface{})[3] != nil {
-								frequency := fmt.Sprintf("%d", int(translationNamesBox[i].([]interface{})[3].(float64)))
-								if frequency == "3" {
-									frequency = "1"
-								} else if frequency == "1" {
-									frequency = "3"
-								}
-								translations[translationType.(string)][translationName]["frequency"] = frequency + "/3"
-
-								translations[translationType.(string)][translationName]["words"] = []string{}
-								if len(translationNamesBox[i].([]interface{})) > 2 && translationNamesBox[i].([]interface{})[2] != nil {
-									for z := 0; z < len(translationNamesBox[i].([]interface{})[2].([]interface{})); z++ {
-										word := translationNamesBox[i].([]interface{})[2].([]interface{})[z].(string)
-										translations[translationType.(string)][translationName]["words"] = append(translations[translationType.(string)][translationName]["words"].([]string), word)
+
+		if len(json_) > 3 && json_[3] != nil &&
+			len(json_[3].([]interface{})) > 5 && json_[3].([]interface{})[5] != nil &&
+			len(json_[3].([]interface{})[5].([]interface{})) > 0 && json_[3].([]interface{})[5].([]interface{})[0] != nil {
+			translationBox := json_[3].([]interface{})[5].([]interface{})[0].([]interface{})
+			for x := 0; x < len(translationBox); x++ {
+				if len(translationBox[x].([]interface{})) > 0 {
+					translationType := translationBox[x].([]interface{})[0]
+					if translationType == nil {
+						translationType = "unknown"
+					}
+					translations[translationType.(string)] = make(map[string]map[string]interface{})
+
+					if len(translationBox[x].([]interface{})) > 1 && translationBox[x].([]interface{})[1] != nil {
+						translationNamesBox := translationBox[x].([]interface{})[1].([]interface{})
+						for i := 0; i < len(translationNamesBox); i++ {
+							if len(translationNamesBox[i].([]interface{})) > 0 && translationNamesBox[i].([]interface{})[0] != nil {
+								translationName := translationNamesBox[i].([]interface{})[0].(string)
+								translations[translationType.(string)][translationName] = make(map[string]interface{})
+								if len(translationNamesBox[i].([]interface{})) > 3 && translationNamesBox[i].([]interface{})[3] != nil {
+									frequency := fmt.Sprintf("%d", int(translationNamesBox[i].([]interface{})[3].(float64)))
+									if frequency == "3" {
+										frequency = "1"
+									} else if frequency == "1" {
+										frequency = "3"
+									}
+									translations[translationType.(string)][translationName]["frequency"] = frequency + "/3"
+
+									translations[translationType.(string)][translationName]["words"] = []string{}
+									if len(translationNamesBox[i].([]interface{})) > 2 && translationNamesBox[i].([]interface{})[2] != nil {
+										for z := 0; z < len(translationNamesBox[i].([]interface{})[2].([]interface{})); z++ {
+											word := translationNamesBox[i].([]interface{})[2].([]interface{})[z].(string)
+											translations[translationType.(string)][translationName]["words"] = append(translations[translationType.(string)][translationName]["words"].([]string), word)
+										}
 									}
 								}
@@ -278,5 +282,5 @@
 		Definitions:    definitions,
 		Translations:   translations,
-		TranslatedText: doc.Find(".result-container").Text(),
+		TranslatedText: translatedText,
 	}, nil
 }
Index: trunk/web/main.go
===================================================================
--- trunk/web/main.go	(revision 21)
+++ trunk/web/main.go	(revision 22)
@@ -40,4 +40,5 @@
 		ttsTo := ""
 
+		var translation engines.TranslationResult
 		if c.Method() == "POST" {
 			from = c.FormValue("from")
@@ -48,4 +49,5 @@
 			} else {
 				translatedText = result.TranslatedText
+				translation = result
 			}
 
@@ -94,5 +96,5 @@
 			"TargetLanguages": targetLanguages,
 			"OriginalText":    originalText,
-			"TranslatedText":  translatedText,
+			"Translation":     translation,
 			"From":            from,
 			"To":              to,
Index: trunk/web/views/index.html
===================================================================
--- trunk/web/views/index.html	(revision 21)
+++ trunk/web/views/index.html	(revision 22)
@@ -67,5 +67,5 @@
             <div class="item-wrapper">
                 <textarea id="output" class="translation item" dir="auto" placeholder="Translation"
-                    readonly>{{.TranslatedText}}</textarea>
+                    readonly>{{.Translation.TranslatedText}}</textarea>
                 {{if .TtsTo}}
                 <audio controls>
@@ -82,4 +82,56 @@
         </div>
 
+        <br>
+
+        <div id="definitions_and_translations">
+            {{ if .Translation.Definitions }}
+            <div class="definitions">
+                {{ range $type, $definitions :=.Translation.Definitions }}
+                <span class="def_type">{{ $type }}</span>
+                <ol>
+                    {{ range $definition_item := $definitions }}
+                    <li>
+                        {{ $definition_item.definition }}
+                        <br>
+                        {{with $definition_item.use_in_sentence}}
+                        <span class="use_in_sentence">"{{$definition_item.use_in_sentence}}"</span>
+                        <br>
+                        {{end}}
+                        {{with $definition_item.synonyms}}
+                        {{ range $synonym_type, $_ := $definition_item.synonyms }}
+                        <span class="syn">
+                            {{if $synonym_type }}
+                            <br>
+                            <span class="syn_type">{{$synonym_type}}: </span>{{end}}{{ range $index, $element := index
+                            $definition_item.synonyms $synonym_type}}{{if $index}}, {{end}}{{$element}}{{end}}
+                        </span>
+                        {{end}}
+                        {{end}}
+                    </li>
+                    {{end}}
+                </ol>
+                {{end}}
+            </div>
+            {{ end}}
+
+            {{ if .Translation.Translations }}
+            <div class="translations">
+                {{ range $def_type, $translations := .Translation.Translations }}
+                <span class="def_type">{{ $def_type }}</span>
+                <ul>
+                    {{ range $word, $word_translations := $translations }}
+                    <li>
+                        <span class="syn_type">{{$word}}:</span>                        
+                        <span class="syn">{{ range $index, $element := $word_translations.words}}{{if $index}}, {{end}}{{$element}}{{end}}</span>
+                        <span class="syn_type">{{$word_translations.frequency}}</span>
+                    </li>
+                    <br>
+                    {{end}}
+                </ul>
+                {{end}}
+            </div>
+            {{end}}
+        </div>
+
     </form>
     <script src="/static/script.js"></script>
