improved task.py