Clean up location-determination code.