Created separate func for getting locations from indexes