refactor shell rpc for security