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


do {
    let input = "cqjxjnds"
    try print(nextValidPassword(input))
}
catch AdventError.WrongChar {
    print("Password had invalid character")
}

        if !has3Straight {
            if curChar == "a" {
                straightCount = 1
            }
            else {
                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
                }
            }
        }
        
