Method get_next_state() created.