Update TreeFactory to make it more readable