Reduce some variable scoping