refactored manager.py