Refactoring new_task.py so it works