Initial work on GUI + some core changes

This is what I've managed to do today, it's pretty stable with minor quirks. All basic features should work using the GUI. Read the commit descriptions for details.
Sorry if I've messed up any formatting, I will clean it up later :)