added DAG analysis to remove redundant code