Improvements to saving logic.