Fixes for RM API v1. Includes minor code clean up.