template and markup wrangling