Improved string comparison