assessment remove null elements
assessment: convert terminate to generator