Foliage generation on material

I’m new to UE and still am learning via tutorials from youtube. I made a material seen from youtube that auto generates the material based on the landscape height. I currently have 3 layers: Grass, Dirt, & Rock. I want to have foliage (grass) on my grass layer only but the way I made this material Im unable to do it as everything mixes before connecting to base color (I might be wrong but that’s what i see from the blueprint stuff)

Here are some screenshots of blueprints and landscape itself:

As you can see in the picture the foilage generates all over the place including dirt and rock layer so it would be very helpful to me if anyone could tell me how I could do that, thanks.