var should probably be the first statement of the function