Refactors in package building code