Refactor saving.