diff --git a/main.go b/main.go
index 948950196fac828b598e25023d899c7749c91c9c..48bb7c867ca56daf0dec0a504e55444277f2b0e6 100644
--- a/main.go
+++ b/main.go
@@ -412,36 +412,44 @@ func main() {
 			}
 			pageContent := string(contents)
 			//Check for client_id
-			clientIdStartIndex := strings.Index(pageContent, "client_id=")
+			clientIdKey := "client_id="
+			clientIdLength := 22
+			clientIdStartIndex := strings.Index(pageContent, clientIdKey)
 			if clientIdStartIndex == -1 {
 				log.Error("No client_id found")
 				http.Error(w, http.StatusText(500), 500)
 			}
-			clientIdStartIndex += 10
-			clientId = pageContent[clientIdStartIndex : clientIdStartIndex+36]
+			clientIdStartIndex += len(clientIdKey)
+			clientId = pageContent[clientIdStartIndex : clientIdStartIndex+clientIdLength]
 			//Check for client_secret
-			clientSecretStartIndex := strings.Index(pageContent, "client_secret=")
+			clientSecretKey := "client_secret="
+			clientSecretLength := 14
+			clientSecretStartIndex := strings.Index(pageContent, clientSecretKey)
 			if clientSecretStartIndex == -1 {
 				log.Error("No client_secret found")
 				http.Error(w, http.StatusText(500), 500)
 			}
-			clientSecretStartIndex += 14
-			clientSecret = pageContent[clientSecretStartIndex : clientSecretStartIndex+36]
+			clientSecretStartIndex += len(clientSecretKey)
+			clientSecret = pageContent[clientSecretStartIndex : clientSecretStartIndex+clientSecretStartIndex]
 			//Check for code
-			codeStartIndex := strings.Index(pageContent, "code=")
+			codeKey := "code="
+			codeLength := 27
+			codeStartIndex := strings.Index(pageContent, codeKey)
 			if codeStartIndex == -1 {
 				log.Info("No code found (optional param)")
 			} else {
-				codeStartIndex += 5
-				code = pageContent[codeStartIndex : codeStartIndex+30]
+				codeStartIndex += len(codeKey)
+				code = pageContent[codeStartIndex : codeStartIndex+codeLength]
 			}
 			//Check for grant_type
-			grandTypeStartIndex := strings.Index(pageContent, "grant_type=")
+			grandTypeKey := "grant_type="
+			grandTypeLength := 27
+			grandTypeStartIndex := strings.Index(pageContent, grandTypeKey)
 			if grandTypeStartIndex == -1 {
 				log.Error("No grant_type found")
 				http.Error(w, http.StatusText(500), 500)
 			}
-			grandTypeStartIndex += 11
+			grandTypeStartIndex += len(grandTypeKey)
 			tempGrandTypeString := pageContent[grandTypeStartIndex:]
 			grandTypeEndIndex := strings.Index(tempGrandTypeString, "&")
 			if grandTypeEndIndex == -1 {