Comparison logic improvements