trimming whitespace with a function