Markup fixing and formatting