implemented server and clientside message handling, further modularization