refactored the MessageCodecs