Reverted some recent changes -- using HashSet instead of Set to represent the derivative classes caused a problem when used as a key for HashMap; also, the old hashing function for CharSet seems to be more robust and provide better performance.