replacing deprecated approach of get_index()