introduce dependency graph and clean up deps