Refactor comparator

[#74762182]