Removed some unnecessary encoding/decoding and normalized newlines.