Fix client. Refactoring