refactor RM to not keep xml around and minor changes