Fixes issue #28.  Now addHandler's semantics are changed, and the
global thresh function runs sequential on the same thread as addHandler.
In the next commit the interface of addHandler will change to reflect this.

Also, add a bunch of debugging related to the handler duplication test.