         }
     }
 
-    if let factor = parse(_factorString, factorParser(parse(_counterString, counterParser), parse(_periodString, periodParser))).defaultTo(nil) {
-        if let secret = parse(_secretString, secretParser).overrideWith(externalSecret) {
-            if let algorithm = parse(_algorithmString, algorithmParser).defaultTo(.SHA1) {
-                if let digits = parse(_digitsString, digitsParser).defaultTo(6) {
+    if let factor = parse(_factorString).with(factorParser(parse(_counterString).with(counterParser), parse(_periodString).with(periodParser))).defaultTo(nil) {
+        if let secret = parse(_secretString).with(secretParser).overrideWith(externalSecret) {
+            if let algorithm = parse(_algorithmString).with(algorithmParser).defaultTo(.SHA1) {
+                if let digits = parse(_digitsString).with(digitsParser).defaultTo(6) {
                     return Generator(factor: factor, secret: secret, algorithm: algorithm, digits: digits)
                 }
             }


func generatorFromStrings(_factorString: String?, _secretString: String?, _algorithmString: String?, _digitsString: String?, _counterString: String?, _periodString: String?, externalSecret: NSData?) -> Generator? {

    func counterParser(string: String) -> UInt64? {
        errno = 0
        let counterValue = strtoull((string as NSString).UTF8String, nil, 10)

        return nil
    }


    func periodParser(string: String) -> NSTimeInterval? {
        if let int = string.toInt() {
