[BE] some renaming + refactoring
[BE] removed unused imports
[BE] basic tree building&reading logic