Make reduceData flexible and adapting to the number of data points
Merging new reduceData features to develop branch