added string compression function