addon to previous commit. Saving gain and commutator state.