refactored code for moderating dryly