Fix node positioning (d3 assumes one child node goes straight down). Refactor some variables.