changed task_handler to update tasks to the next closest stage on each run