Removed old code
Fixed calculation of decoded length