         return nil
     }
 
-    func parse<T>(raw: String?, parse: (String -> T?)) -> ParseResult<T> {
-        if let string = raw {
-            if let value = parse(string) {
-                return .Result(value)
-            } else {
-                return .Error
-            }
-        }
-        return .Default
-    }
 
     func periodParser(string: String) -> NSTimeInterval? {
         if let int = string.toInt() {


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)

        }
    }

    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)
                }
            }
