Code refactorings and fixed client-to-server messaging.