Fixed MainWindow and added better debugging.  Improved speed.