Proper encoiding implemented and tested.