Cleaned up compareTo method.