refactoring personal save function