Adding getLocations function