remove var declaration from if statement