Scoped some more variables to local scope