Removing old package algorithm