         return false
     }
 
-    public subscript (position: Int) -> UInt8?  {
-        if position < alphabet.count {
-            return alphabet[position]
-        }
-        return nil
+    public subscript (position: Int) -> UInt8  {
+        precondition(position >= 0 && position < alphabet.count, "out-of-range access on a alphabet")
+        return alphabet[position]
     }
 }
 

            let base0 = inputArray[i]
            let base1 = inputArray[i + 1]
            let base2 = inputArray[i + 2]
            guard   let value0 = coding[Int((base0 >> 2) & 0x3F)],
                    let value1 = coding[Int(((base0 & 0x3) << 4) | ((base1 & 0xF0) >> 4))],
                    let value2 = coding[Int(((base1 & 0xF) << 2) | ((base2 & 0xC0) >> 6))],
                    let value3 = coding[Int(base2 & 0x3F)] else {
                    throw Base64Error.CodingError
            }

            bytes.append(value0)
            bytes.append(value1)


public struct Base64 {
    public static func decode(string: String, coding: Base64Coding = .Standard) throws -> NSData? {
        if string.isEmpty { return nil }
        
        if coding.stringContainsIllegalCharacters(string) == true {
            throw Base64Error.ContainsIllegalCharacters
