Support for <hi> tag, plus minor refactoring