Refactor templates
Add rice test