Added a function to trim trailing whitespaces on save.