solving some variable scoping issues