Added some index logic.