Refactor list of package extensions in a function.