Fixed encoding parameters, tweaked some code
Weird issues occured