Sorted out the HTML in the tempalte