finished and tested decoder