modified dowork.py