Add function to strip trailing whitespace