redone: parse character sets correctly
tests: added more tests
redone: remove redundant memoise