Adding client main loop