restructured, added hash-based equality