Simplify comparison function