better variable scoping