Finished the main compile function