added rate var and if - pro

changed = to == in if