Refine markup and apply necessary styling