Refactoring into Codec.