Move number-aware comparison logic into misc class.