I wonder if there is not a little more to do here ? Like resetting other states ? (but you know better than me)

Also, how about calling this function "reset" instead of "restart" ?