Rewrite and simplify output handlers.

cc @DorianGray 

If this goes well, will cut rc-v1.