added an earlier save function