History saving

Changes to when history is saved and fixed config of how it gets saved.