Moved the logic from main.cpp to GlobalState and otherwise did a little reorganizing. I can't test currently as this system has Qt4 installed, while I'm building against Qt5, but there shouldn't be any glaring errors.