             message: String(cString: sajson_get_error_message(dptr)))
     }
 
-    return Document(doc: dptr)
+    return Document(doc: dptr, input: copy)
 }
 
 public func parse(allocationStrategy: AllocationStrategy, input: String) throws -> Document {

}

public final class Document {
    internal init(doc: OpaquePointer!) {
        self.doc = doc

        let rootType = sajson_get_root_type(doc)
        let rootValuePaylod = sajson_get_root(doc)!

}

public func parse(allocationStrategy: AllocationStrategy, input: Data) throws -> Document {
    // withUnsafeMutableBytes probably copies input into a new buffer
    var copy = input
    let dptr: OpaquePointer! = copy.withUnsafeMutableBytes { (ptr: UnsafeMutablePointer<Int8>) in
        switch allocationStrategy {
        case .single:
