MeanShift refactoring