changed: Improve compare logic