refacted the equals to use methods rather than instance variables