massive fixes and rewrite of networking
fix bug for multiple messages