clean up equality code a bit