Reorganising files
Cleaning up main code