First working worker version.
Better encoded buffer handling. Stream cleanup.