Rename encoder to writer.
Refactoring.
Merge pull request #9 from benbjohnson/refactor

Refactor