move run_client to lib.cpp