added sorting of scatter indices based on source indices so we can get the most benefit from converting index arrays to slices