String cleanup functions added

Multiple spaces replaced with a single space in the input, leading and trailing spaces trimmed.