Removed the old system for this and implemented one that is similar to how it's being done for HTML export.