refactoring code for RDCS