moving var statements to the top of the scope