add optimization for contiguous indexing on terminal