added removal of trailing whitespace on save