Add task running related logic.