Move export logic to class Exporter

This will facilitate a web-based export significantly easier