Restructured rpc system and added support for rpc-ing from the browser to the server