Changed the save function