Refactor CreateNetwork

extract methods for leaf and branch nodes.