First pass implementation, including clean roundtripping