Comparator: Rearranged code