 		/** `Data`. 16 bytes (128-bit IEEE 754-2008 decimal floating point).
 		Currently returned as a Data object containing 16 bytes. */
 		case double128Bits       = 0x13
-		/** `NSDate`. Raw value is the number of milliseconds since the Epoch in
-		UTC in an Int64. */
+		/** `Date`. Raw value is the number of milliseconds since the Epoch in UTC
+		in an Int64. */
 		case utcDateTime         = 0x09
 		/** `NSRegularExpression`. Raw value is two cstring: Regexp pattern first,
 		then regexp options. */

		/** An invalid element was found. The element is given in argument to this
		enum case. */
		case invalidElementType(CUnsignedChar)
		
		/** Invalid UTF8 string found. The raw data forming the invalid UTF8
		string is given in argument to this enum case. */

			}
			
			let key = try readCString(buffer: buffer, bufferStartPos: &posInBuffer, bufferValidLength: &bufferSize, maxBufferSize: maxBufferSize, totalNReadBytes: &totalBytesRead, stream: stream)
			switch BSONElementType(rawValue: currentElementType) {
			case .null?:
				ret[key] = NSNull()
				
			case .boolean?:
				let valAsInt8 = try readDataFromBuffer(dataSize: 1, alwaysCopyBytes: false, buffer: buffer, bufferStartPos: &posInBuffer, bufferValidLength: &bufferSize, maxBufferSize: maxBufferSize, totalNReadBytes: &totalBytesRead, stream: stream).first!
				switch valAsInt8 {
				case 0: ret[key] = false
				case 1: ret[key] = true
				default: throw BSONSerializationError.invalidBooleanValue(valAsInt8)
				}
				
			case .int32Bits?:
				let val: Int32 = try readType(buffer: buffer, bufferStartPos: &posInBuffer, bufferValidLength: &bufferSize, maxBufferSize: maxBufferSize, totalNReadBytes: &totalBytesRead, stream: stream)
				ret[key] = val
				
			case .int64Bits?:
				let val: Int64 = try readType(buffer: buffer, bufferStartPos: &posInBuffer, bufferValidLength: &bufferSize, maxBufferSize: maxBufferSize, totalNReadBytes: &totalBytesRead, stream: stream)
				ret[key] = val
				
			case .double64Bits?:
				let val: Double = try readType(buffer: buffer, bufferStartPos: &posInBuffer, bufferValidLength: &bufferSize, maxBufferSize: maxBufferSize, totalNReadBytes: &totalBytesRead, stream: stream)
				ret[key] = val
				
			case .double128Bits?:
				ret[key] = try readDataFromBuffer(dataSize: 16, alwaysCopyBytes: true, buffer: buffer, bufferStartPos: &posInBuffer, bufferValidLength: &bufferSize, maxBufferSize: maxBufferSize, totalNReadBytes: &totalBytesRead, stream: stream)
				
			case .utcDateTime?:
				let timestamp: Int64 = try readType(buffer: buffer, bufferStartPos: &posInBuffer, bufferValidLength: &bufferSize, maxBufferSize: maxBufferSize, totalNReadBytes: &totalBytesRead, stream: stream)
				ret[key] = Date(timeIntervalSince1970: TimeInterval(timestamp))
				
			case .regularExpression?:
				fatalError("Not Implemented")
				
			case .utf8String?:
				ret[key] = try readString(buffer: buffer, bufferStartPos: &posInBuffer, bufferValidLength: &bufferSize, maxBufferSize: maxBufferSize, totalNReadBytes: &totalBytesRead, stream: stream)
				
			case .dictionary?:
				fatalError("Not Implemented")
				
			case .array?:
				fatalError("Not Implemented")
				
			case .timestamp?:
				ret[key] = try readDataFromBuffer(dataSize: 8, alwaysCopyBytes: true, buffer: buffer, bufferStartPos: &posInBuffer, bufferValidLength: &bufferSize, maxBufferSize: maxBufferSize, totalNReadBytes: &totalBytesRead, stream: stream)
				
			case .binary?:
				fatalError("Not Implemented")
				
			case .objectId?:
				ret[key] = try readDataFromBuffer(dataSize: 12, alwaysCopyBytes: true, buffer: buffer, bufferStartPos: &posInBuffer, bufferValidLength: &bufferSize, maxBufferSize: maxBufferSize, totalNReadBytes: &totalBytesRead, stream: stream)
				
			case .javascript?:
				ret[key] = try readString(buffer: buffer, bufferStartPos: &posInBuffer, bufferValidLength: &bufferSize, maxBufferSize: maxBufferSize, totalNReadBytes: &totalBytesRead, stream: stream)
				
			case .javascriptWithScope?:
				fatalError("Not Implemented")
				
			case .minKey?:
				fatalError("Not Implemented")
				
			case .maxKey?:
				fatalError("Not Implemented")
				
			case .undefined?:
				fatalError("Not Implemented")
				
			case .dbPointer?:
				fatalError("Not Implemented")
				
			case .symbol?:
				ret[key] = try readString(buffer: buffer, bufferStartPos: &posInBuffer, bufferValidLength: &bufferSize, maxBufferSize: maxBufferSize, totalNReadBytes: &totalBytesRead, stream: stream)
				
			case nil: throw BSONSerializationError.invalidElementType(currentElementType)
			case .endOfDocument?: fatalError() /* Guarded before the switch */
			}
		}
		guard totalBytesRead == length else {throw BSONSerializationError.invalidLength}
