refactor fill_tasks