removes unused code
improves syntax in equal method