Wrote pathToIndex