Threshold: tweak javadoc
OutputFunction: tweak javadoc
Big changes to threshold code

I know, I know. I am a bad person for making such a horrible tangled
mess of a commit. But untangling this is taking too many hours, which
can be better spent on further progress for OPS.

So: apologies to my future self, and anyone else bitten by bugs
introduced at this juncture.