Cleaning up logic in exports.jinja along with adding comments to code.