modified package installation algorithm