Refactoring for rice 2.0