Seems that variable `control` is used only inside the next `if`. It should be declared nearer to place of using.