Changed the way computeProfile computes profiles. Complexity decreased from quadratic in the number of points to linear.