Refactor lobby state machine.