added equals method and corresponding tests