Added better scoping