General refactoring, improve simple codec, improve tests and benchmarks.

Fixes #30