Reworked the RPC to track types more accurately.