Move tag handlers to their own package.
Fix sending text to the wrong stream when there are multiple streams on
the stack after one of them is popped.