var should always be declared at the top of the function.