better restart function