moved diskspace checking to tree and refactored