Factor out subtask-specific code into subtasks.py.