Replace ad hoc factory functions with PackageSet class
Rename packagefactory to packageset