Add function to remove trailing whitespace