Added StripTrailingWhitespace function