Added proper scoping