Fixed some bugs, redesigned main window