bug fix & main window added & change structure