Changed a variable declaration to top of block