Cleanup and produce a list of tasks.