updated the getlocations function to the latest version