added main_state to manage the game