Make q variables local to function scope

In execute and nestedExecute functions, changed q variable to "var q" so that it's not in the global scope
Merge pull request #146 from wujitouch/master

Make q variables local to function scope