add restart/restartRunningTask/restartActiveContext handlers, refactor