Optimization for decoding, about 2x. The implementation is still a little messy, though.