I'm not sure I could explain the derivation well without being really verbose.  This code was originally from you ... maybe you can suggest the text?