Refactoring variable and function scoping on ManagerSpec