Helpers through Hierarchy

Need to some help here. This code creates point helpers through a hierarchy of helpers.

Setup: Create some point helpers and then make it branch out into 3 other helpers, like a hand for example.
Link them all up and then select the top parent and run the script. The setup should look a bit like this. Then select the top most parent in the chain of hierarchy. You’ll notice that the bottom one gets a duplicate as well as the linking seems to be incorrect on the helpers created?
Thanks in advance.

global parentCtrlPtChain = undefined
fn deformBnToChildren startPoint parentCtrlPt ctrlPtCount = 
 if (startPoint.children.count > 0) do
 local parentCtrlPt = undefined
 local endPos = undefined
 for c in startPoint.children do
 local deformCtrlPt = undefined
 startPos = startPoint.pos
 endPos = c.pos
 ptCount = (ctrlPtCount as integer)
 --// Create x number of CtrlPoints between two points throughout hierarchy
            for i = (1.-1) to ptCount do
 PosPerct = (startPos + ((endPos-startPos)*((i/ptCount))))
 deformCtrlPt = Point wirecolor:blue box:true cross:false size:5 pos:PosPerct
 deformCtrlPt.parent = parentCtrlPtChain
 parentCtrlPtChain = deformCtrlPt
 if (parentCtrlPt != false) do
 deformBnToChildren c newBone ptCount
for obj in getCurrentSelection() do deformBnToChildren obj false 3 
helper.png8.96 KB