Refactored html build function + More comments