improve code to return an empty list of packages if no packages are found