Better project organisation.

Renamed some of the classes. Control flow is now more sensible.