Divided the communication/loop logic and the game logic;
Added the possibility of multiple connections (untested).