Removed duplicate code
Fixed wrong default content-type header
Fixed charset fix
Fixed tests