Fixed logic and made emails send for every row (not just one per person per homework)