Initial encoder and decoder implementation. Tests are working fine.