Added basic encoder and decoder