Code optimizations

I found that with large amounts of data the decompression chokes very hard.
These optimizations seem to help quite a bit.