refactor dependency preparation

and some node.py cleanup