more refactoring for RPC compatability