Cleanup in the RPC mechanism for forwards compatibility + a bunch more unit tests