refactoring treebase import to external.py and bug fixes