Sort Polyline curves with same Z coordinates to same data tree branches

Hi
I’m trying to make a data tree, containing all the polyline curves with the same Z-height in the same data tree branch. I currently have all the polyline curves in different branches, but as shown on the picture on line 2 there are 2 polylines on the same height. these should be in the same branch.
Thank you.
Robbe

Hello,

Can you upload your GH file with internalized geometry ?

https://discourse.mcneel.com/search?expanded=true&q=member%20index%20%40Joseph_Oster

picard-facepalm

Sort for Z heights.gh (15.9 KB)
Hi I added the file here. If you’re missing any data, please let me know.
Thank you

They appear to be grouped by branch already.