Made method calc_index