The magic number for ports
Stash.
Getting close.
Patch failing to apply when the tree isn't fully built for the resource being added. Going to have to take a recursive approach that builds the path as a function calls itself.
Refactored. Needs debugging.