Edit checkAffected function