cleanup, better handling of tasks