Tree topology code partially completed.