working version of DAG