index_from_to method