Fixed several bugs with comparators and refactored