Added 'condition' parameter to generator