Trivial nit: can we use 'index' here instead of 'idx'?