refactoring rais plugin