Rework of server and client

Complete rework