rpc: added register function and switched to hash table