 
 import Foundation
 
-public let JSONTrue = JSON(true)
-public let JSONFalse = JSON(false)
-
-public let JSONNull = JSON.jsonNull
-
 enum JSONError: ErrorProtocol {
     case parseError(String)
 }
 
 public enum JSON : Equatable, CustomStringConvertible {
     
-    case jsonString(String)
-    case jsonNumber(Double)
-    case jsonObject(Dictionary<String, JSON>)
-    case jsonArray(Array<JSON>)
-    case jsonBool(Bool)
-    case jsonNull
-    case jsonInvalid
+    case string(String)
+    case number(Double)
+    case object(Dictionary<String, JSON>)
+    case array(Array<JSON>)
+    case bool(Bool)
+    case null
+    case invalid
     
     init(_ value: Bool?) {
         guard let bool = value else {
-            self = .jsonInvalid
-            return
-        }
-        self = .jsonBool(bool)
+            self = .invalid
+            return
+        }
+        self = .bool(bool)
     }
     
     init(_ value: Double?) {
         guard let number = value else {
-            self = .jsonInvalid
-            return
-        }
-        self = .jsonNumber(number)
+            self = .invalid
+            return
+        }
+        self = .number(number)
     }
     
     init(_ value: Int?) {
         guard let number = value else {
-            self = .jsonInvalid
-            return
-        }
-        self = .jsonNumber(Double(number))
+            self = .invalid
+            return
+        }
+        self = .number(Double(number))
     }
     
     init(_ value: String?) {
         guard let string = value else {
-            self = .jsonInvalid
-            return
-        }
-        self = .jsonString(string)
+            self = .invalid
+            return
+        }
+        self = .string(string)
     }
     
     init(_ value: [JSON]?) {
         guard let array = value else {
-            self = .jsonInvalid
-            return
-        }
-        self = .jsonArray(array)
+            self = .invalid
+            return
+        }
+        self = .array(array)
     }
     
     init(_ value: [String: JSON]?) {
         guard let dict = value else {
-            self = .jsonInvalid
-            return
-        }
-        self = .jsonObject(dict)
+            self = .invalid
+            return
+        }
+        self = .object(dict)
     }
     
     init(_ rawValue: AnyObject?) {
         guard let value = rawValue else {
-            self = .jsonInvalid
+            self = .invalid
             return
         }
 
         switch value {
         case let data as Data:
             do {
-                let jsonObject = try JSONSerialization.jsonObject(with: data, options: [])
-                self = JSON(jsonObject)
+                let object = try JSONSerialization.jsonObject(with: data, options: [])
+                self = JSON(object)
             } catch {
-                self = .jsonInvalid
+                self = .invalid
             }
             
         case let array as NSArray:
             let newArray = array.map { JSON($0) }
-            self = .jsonArray(newArray)
+            self = .array(newArray)
             
         case let dict as [String: AnyObject]:
             var newDict = [String: JSON]()
             for (key, value) in dict {
                 newDict[key] = JSON(value)
             }
-            self = .jsonObject(newDict)
+            self = .object(newDict)
             
         case let string as String:
-            self = .jsonString(string)
+            self = .string(string)
             
         case let number as NSNumber:
             if number.isBool {
-                self = .jsonBool(number.boolValue)
+                self = .bool(number.boolValue)
             } else {
-                self = .jsonNumber(number.doubleValue)
+                self = .number(number.doubleValue)
             }
             
         case _ as NSNull:
-            self = .jsonNull
+            self = .null
             
         default:
             assert(true, "This location should never be reached")
-            self = .jsonInvalid
+            self = .invalid
         }
 
     }
 
     public var string : String? {
-        guard case .jsonString(let value) = self else {
+        guard case .string(let value) = self else {
             return nil
         }
         return value
     }
 
     public var integer : Int? {
-        guard case .jsonNumber(let value) = self else {
+        guard case .number(let value) = self else {
             return nil
         }
          return Int(value)
     }
 
     public var double : Double? {
-        guard case .jsonNumber(let value) = self else {
+        guard case .number(let value) = self else {
             return nil
         }
         return value
     }
 
     public var object : [String: JSON]? {
-        guard case .jsonObject(let value) = self else {
+        guard case .object(let value) = self else {
             return nil
         }
         return value
     }
 
     public var array : [JSON]? {
-        guard case .jsonArray(let value) = self else {
+        guard case .array(let value) = self else {
             return nil
         }
         return value
     }
 
     public var bool : Bool? {
-        guard case .jsonBool(let value) = self else {
+        guard case .bool(let value) = self else {
             return nil
         }
         return value
     }
 
     public subscript(key: String) -> JSON {
-        guard case .jsonObject(let dict) = self, let value = dict[key] else {
-            return .jsonInvalid
+        guard case .object(let dict) = self, let value = dict[key] else {
+            return .invalid
         }
         return value
     }
 
     public subscript(index: Int) -> JSON {
-        guard case .jsonArray(let array) = self where array.count > index else {
-            return .jsonInvalid
+        guard case .array(let array) = self where array.count > index else {
+            return .invalid
         }
         return array[index]
     }
 
     static func parse(jsonData: Data) throws -> JSON {
         do {
-            let jsonObject = try JSONSerialization.jsonObject(with: jsonData, options: .mutableContainers)
-            return JSON(jsonObject)
+            let object = try JSONSerialization.jsonObject(with: jsonData, options: .mutableContainers)
+            return JSON(object)
         } catch {
             throw JSONError.parseError("\(error)")
         }
     }
 
-    static func parse(jsonString : String) throws -> JSON {
+    static func parse(string : String) throws -> JSON {
         do {
-            guard let data = jsonString.data(using: .utf8, allowLossyConversion: false) else {
+            guard let data = string.data(using: .utf8, allowLossyConversion: false) else {
                 throw JSONError.parseError("Cannot parse invalid string")
             }
             return try parse(jsonData: data)

extension JSON {

    public var description: String {
        guard let jsonString = stringify() else {
            return "<INVALID JSON>"
        }
        return jsonString
    }

    private func prettyPrint(_ indent: String, _ level: Int) -> String {

    }

    func stringify(_ indent: String = "  ") -> String? {
        guard self != .invalid else {
            assert(true, "The JSON value is invalid")
            return nil
        }
