Started working on refactoring of tree conversion.