refactoring rbi code