Start to refactor tree to support submodules