restructuring dependency graph