refactoring code for escalation reports