refactor in anticipation of move to html