updating api so that index is passed to init method as a path