updated checks with forEach