Move "var" to the top of the function.