Refactored HTML creation