Make local variables really local

This patch makes local variables really local, so they don't pollute the global scope.