Make state_history a stack