Bits of refactoring to simplify rmt.scm