fixed redunandt code