Added StripExtraWhitespace function