removed some unnecessary equality code, and fixed a small sorting bug