splitted into serveral files
first draft of tree building
tree building done