rebuilt link and delete logic