Implemented the save and saveAs methods