refactored decompressor to read from memory