Refactored html rendering.