Refactor package related code
I'm working on #14335 and I figured the package related code could benefit from some refactoring and additional comments first.
See the commit descriptions for more details.
I'm working on #14335 and I figured the package related code could benefit from some refactoring and additional comments first.
See the commit descriptions for more details.