cleaning up some nasty looking code
more code cleanup
updating main view