Implemented new tread structure.
TODO: Fix a bug where the whole app freeze if it sends a msg to the game.