Removed ununsed global variables in local scopes
Merge pull request #5638 from coenjacobs/code-cleanup

Removed unused global variables in local scopes