Implement hashCode and equals

We will need comments here. This will be a separate ticket.