refactor the client network setup