tidied up simple string compression