refactoring save functions
refactoring save functions