optimise the package install and remove steps by filtering out packages needs that are already satisfied