Refactoring of the HTML report code