Detect Dragging position in a for loop

Hi, been on Babylon for a few days now and absolutely loving it!

I am trying to add some simple drag behaviour to 3 planes created in a for loop but for some reason can’t seem to understand what is going wrong.

I started by creating just 1 simple plane and adding the drag behaviour and then with pointerDragBehavior.attachedNode.position.y I was able to detect the plane’s position. You will notice that if you drag the plane too much it will reset it’s position.
Simple working example

Then I tried creating various planes in a for loop and here’s where I’m stuck as I can’t seem to detect the dragging position of the plane anymore.
See here

Initially I wanted to put all the pointerDragBehaviour stuff outside/before the for loop but it wouldn’t work either. Not sure what I am doing wrong, any help would be much appreciated :pray:

EDIT: I now realised that the last created plane in the loop works nicely, so I am assuming I am overwriting the functions in the for loop and only the last one is registered properly?

I tried changing from var to const within the for loop and it worked nicely
Working example here