Adds headings and fixes anchors