Added extractPackage function