Merge pull request #31 from benniel/rewrite

Fixes and clean-ups
Fixed result encoding for the workers.
Merge pull request #32 from filinep/rewrite

Fixed result encoding for the workers.