Recent review of this model from Jeremy Dalseno:
Bottom line: the code is essentially OK as it is, but can be simplified, and we can also make some improvements to the documentation to clarify the various subtleties and advise on best practice.
The main simplification is that the delta and B parameters cannot be independently determined since the denominator is almost exactly 1 even in the cases where we do not fix it to 1.
So probably we can drop B and rename phiB to argDelta or something like that. The fact that B didn't appear in the denominator was actually incorrect but the effect was negligibly small in any case.
In fact, we could consider dropping the cases where we allow the denominator to deviate from unity, since the deviations are extremely tiny in any case. This would allow further simplifications of the code.