refactoring code for RBOP