replaced repetition of hash/equals function declarations with macro