Exporting updates

Several updates to the html exporting. See commits for more details. Still need to hook it up to the UI.