Refactored equals method
Refactored equals method