Tree building algorithm without duplication

This pull request addresses the first of my promises about my work on kingpin:

> Things I'm gonna focus at are:

> 1) <del>I want eliminate these two large similar sections of buildTree() by writing a one instead, but the one without "X or Y" branching.</del>