refactor install_packages