Move restart state logic into event_listeners.js