working out details with shutdown on refactored code