Refactoring and cleanup based on Bernard's comments; Equals and hashCode for Relation, Tuple, etc