HTML template refactoring