Refactor Rsm.