Move variables to the place of their use
Fix typo