Fixed message handling and TCPServer now runs in a Thread