build tree