Improve Client logic. Add logging.