Added equals, hashCode, toString and endsWith methods