Start of MedianCut class... Needs lots more refactoring...