Improve test coverage

Adds a new encoder roundtrip test and deletes some dead code.