Changed the structure for how the files are assembled and written out.
It was done to make things more modular, and also to make writing out
imports easier.