Code refactored + client continued