Attempting to implement circular suffix array.