add encoder and decoder