Added the save function

Save function is fully implemented