some optimisations to compress and decompress

changed name of compress and decompress methods along with minor
optimisations.