Refactor HTML iteration to support nested text

Fixes a terrific amount of leaked memory, and closes #2.