Refactoring getPackage.