move more of the HTML templating stuff to Kmisc