Adds RPC support

* Defines messages and register usage for RPC
* Some refactoring to accomodate RPC