This is a very complicated part of the codebase, as we have to convert the array [package1, package2, package3] into a binary tree.
Although this seems like a simple problem at first. The algorithm for this is... bad. I'm not closing this until I finish the algorithm into something that simply works.