cleaned up Barath's merge, added early DAG