Subgoals rendered in correct position using insertBefore property of parent node