modify MainLoop Class to Singleton and reduce many codes