for(int index = 0; index < 4; index++)
Wrong, array number from 0 so you have indexes 0,1 and 2.
Mark