added modular division to index to ensure that it rolls over