a much faster g22g1 (original approach) and a bug fix in the

new approach
named function to compute indices