Refactoring encoders to codecs
Adding unit tests for codecs