Fix off-by-one error, consolidate array index operators.