Registered handlers now overwrite previous ones rather than getting silently appended, never to be invoked.

10 test failures.
Adds additional error checking.