warnings fixes
Initial improvements to get rid of the performance regression in py3.

Byte buffer concatenations are considerably slower here for some reason.
Also there was no need for the memorybuffer.
Fixed a few typos and major linter errors
Merge branch 'py2n3'

Clode cleanup and performance regression fixes in py3