Minor changes to comparator function for readability