some fixes, so client - server now connects, refactoring