refactors client code
do some changes