Distributed KD-Tree code refactored and commented