integrated client into main code