Fix history bug
Remove trailing whitespaces
Add hook to remove trailing whitespaces on save