 			currentValue = isNSNull ? nil : object
 		} else {
 			// break down the components of the key that are separated by .
-			(isKeyPresent, currentValue) = valueFor(ArraySlice(key.components(separatedBy: ".")), dictionary: JSON)
+			(isKeyPresent, currentValue) = valueFor(ArraySlice(key.components(separatedBy: delimiter)), dictionary: JSON)
 		}
 		
 		// update isKeyPresent if ignoreNil is true

	/// The Key paramater can be a period separated string (ex. "distance.value") to access sub objects.
	public subscript(key: String) -> Map {
		// save key and value associated to it
		let nested = key.contains(".")
        return self[key, nested: nested, ignoreNil: false]
	}
	
	public subscript(key: String, nested nested: Bool) -> Map {
	    return self[key, nested: nested, ignoreNil: false]
	}
	
    public subscript(key: String, ignoreNil ignoreNil: Bool) -> Map {
        let nested = key.contains(".")
        return self[key, nested: nested, ignoreNil: ignoreNil]
    }
    
    public subscript(key: String, nested nested: Bool, ignoreNil ignoreNil: Bool) -> Map {
		// save key and value associated to it
		currentKey = key
		keyIsNested = nested

		// check if a value exists for the current key 
		// do this pre-check for performance reasons

	public internal(set) var currentValue: Any?
	public internal(set) var currentKey: String?
	var keyIsNested = false
	public internal(set) var nestedKeyDelimiter: String = "."
	public var context: MapContext?
	
	let toObject: Bool // indicates whether the mapping is being applied to an existing object
