Reduce insanity in ensure_packages function