Refactor character classes

I refactor the character classes, especially focusing on the
merits and contracts methods.