Move variable declarations to more specific scopes
Merge pull request #13 from elliotkendall/scope

Move variable declarations to more specific scopes