refactor html templates