Improve computation of unneeded packages