Added start and end index arguments