Initial modularization attempt, makes things much more split up.

Needs better file names, but makes code much clearer.

GUI code has been greatly split, and it actually increases speed a tiny bit.

Also, removed a few useless debug messages.