move inversion code to resonator