changed equals method to fix solution 2