move var statements to the top