Make variable definition pattern consistent
Move var definition to top of scope