         if !has3Straight {
             if curChar == "a" {
                 straightCount = 1
-                continue
-            }
-            
-            guard let curCharIndex = alphabet.indexOf(curChar), let prevCharIndex = alphabet.indexOf((prevChar)) else {
-                throw AdventError.WrongChar
-            }
-            
-            if curCharIndex == prevCharIndex.successor() {
-                straightCount = straightCount + 1
-                if straightCount == 3 {
-                    has3Straight = true
-                }
             }
             else {
-                straightCount = 1
+                guard let curCharIndex = alphabet.indexOf(curChar), let prevCharIndex = alphabet.indexOf((prevChar)) else {
+                    throw AdventError.WrongChar
+                }
+                
+                if curCharIndex == prevCharIndex.successor() {
+                    straightCount = straightCount + 1
+                    if straightCount == 3 {
+                        has3Straight = true
+                    }
+                }
+                else {
+                    straightCount = 1
+                }
             }
         }
         

}

func nextValidPassword(oldPass: String) throws -> String {
    var curPass = oldPass
    var found = false
    
    while found == false {


do {
    let input = "cqjxjnds"
    
    let nextValidPass1 = try nextValidPassword(input)
    print("Part 1: " + nextValidPass1)
    
    let nextValidPass2 = try nextValidPassword(nextValidPass1)
    print("Part 2: " + nextValidPass2)
}
catch AdventError.WrongChar {
    print("Password had invalid character")
}