Adding decodeCompact and encodeCompact functions