Made variable scoping tighter.