add PackageFactory and more detailed exceptions