shorten code in manager.py