It feels the z-transform is distracting from the problem at hand, which is to get some actual code going to do phase demodulation. Otoh, it would require solving a couple of things. What I miss is insight and basic structure. The split of Ring vs. Function seems to be a good idea. Should div be part of Ring?