HTML table creation moved to another method and refactored