 
     static func seqForSlug(_ slug: String) throws -> Int64 {
         let slugChars = Array(slug.characters)
-        let intValue = try slugChars.map({ letter in
-            return try Shortener.intFromAlphabetLetter(letter)
+        let checksum = String(slugChars.prefix(upTo: 2))
+        let encodedSeq = slugChars.suffix(from: 2)
+
+        let intValue = try encodedSeq.map({ letter in
+            return try intFromAlphabetLetter(letter)
         }).reduce(Int64(0), combine: +)
-        print("intv: \(intValue)")
 
-        return intValue
+        let checksumFromDecoding = checksumForSeq(intValue)
+        
+        if checksum == checksumFromDecoding {
+            return intValue
+        } else {
+            throw ShortenerError.InvalidChecksum
+        }
     }
 
     static func intFromAlphabetLetter(_ letter: Character) throws -> Int {

            throw ShortenerError.InvalidAlphabetCharacter
        }
    }
}

    case FailedURL
    case InvalidId
    case InvalidAlphabetCharacter
    case InvalidChecksum
}

class Shortener {
    static let alphabet: [Character] = Array("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".characters)

    static func generateSlug(fromSeq seq: Int64) throws -> String {
        let alphabetEncoded = intToAlphabet(int: seq, alphabet: alphabet)
        let checksum = checksumForSeq(seq)
        return checksum + alphabetEncoded
    }

    static func urlForSlug(_ slug: String) throws -> NSURL {
