now the save function is working