`var` should be at the top of the function.