added check in equals for efficiency