COOPR-518: refactored code