reworked model, added client part and tests