Refactored function determining validity of input data when adding a location.