wasnt handling two emails properly due to scoping