Deleting old package algorithm