Strip trailing whitespace from messages.
Break out generic utility functions into their own file.