Refactored, first sucessful compile and export.