Moved comparison functions into comparator classes.