Changing to MVC format.

Changing core code to follow more of an MVC line. Problems with the
MainWindow right now.
Fixed SIGSEGV.