Add a roundtrip test
Implement #9, #11