changed compare logic