changed variable clicked_index to selected_indices to reflect change in usage