rewrite2 lots of task-saving cleanup