refactoring saving