removing redundent code