add the restart logic