Saving function improvement