Improve package removal by using a two phase approach: check and removal.