Fix mid/mindex confusion.
Fix comments.