Add client representation. Refactoring. Fixing bugs.