Uses tree to store model