Refactored equals method 

Reduced in hopes of reducing cyclomatic complexity
Fixed some checkstyle errors.
Merged test cases.