Refactored comparison functions for priority queue class