holy fuck my implementation of  and  were nontrivially off.
holy shit,  is recursive--makes so much more sense