Finished the save function