socket_cli is refactored, code cleaned and some fixes