Modified to use rpc wrapper