added encoder, decoder