This can be at file scope. Its only used in `computePositions`. Some of the other functions can also be at file scope.