Doesn't buildParentMap() know about @measure already? Why do we need to pass in a piece of it, rather than referencing it from within the function? Could this be simplified even further by just passing in "code"?