rvm.c refactor begun