COOPR-520: refactored code