refactor results determination and email