replaced infinite loops for start and restart