adds semantic markup and other cleanup