rename get_cell_id -> find_discrete_state, and refactor it