move var declaration before they are used