change some classes and add ThreadWithMsgQueue