Implemented the bulk of the RPC code, added documentation for RPC protocol