Some of the changes led to errors occurring related to the mismatched dimensions: ValueError: Buffer has wrong number of dimensions (expected 2, got 1) so I left compute_ind_extr() unchaged