Clean up createTree a bit