Refactored equals and hashcode to use JDK7's Objects