speaker indices function needs improvements