break scratchwork into functions

I also renamed tadpole() to tpol_prf (read "tadpole proof").