alert conditions and delete unnecessary