Changed distance functions to take Eigen::MatrixBase and return distance instead of having distance variable passed in.