Stopping and closing and restarting works
Tidy code