new implementation of location selection