Implemented the Saving function and its test.