Scrolling text for POV display

Okay so i'm trying to make scrolling text on my POV. I managed to do it with the code below but the scrolling resets after certain time period and i don't know why. Posting the code below. Basically i have a fototransistor and with each turn if fototransistor receives light arduino knows where the text begins and adds to unsigned long before and then delays(before). I don't have resetting mechanism yet but will add it after i figure this out. Be kind and help a brotha out.

// ********* display program *************//








//******************* changable parameters *********************//
 
#include <SoftwareSerial.h>  
#include <dictionary>                    
SoftwareSerial Bluetooth(2, 3);                // 10-Rx & 11-Tx BT pins
int BluetoothData;

int pins[] = {11,10,9,8,7,6,5};               // LED pins
int rows= 7;
String msg;
int limit, data;
int timer1 = 450;        // time between columns
int timer2 = 400;                // time between frames
int frame_len = 5;                // frame length for new dictionary
int frame,row; 
unsigned long before;


void setup()                                  
{
  int rst;
  Bluetooth.begin(9600);                        // sets communication speed to 9600bps.
  for (rst = 0; rst < rows; rst++)              // resets the display
  {
    
    pinMode(pins[rst],OUTPUT);                  
  } 
}


void loop()                                     
{
//******** Bezdrátové Ovládání POV **********//
wireless();                         // wireless function                    
}



void show( byte *image )    {                                  // Display function
  int frame,row;
  
   

    for (frame = 0; frame < frame_len; frame++)                            // displays columns
    {
      for (row = 0; row < rows; row++)                               // displays rows
      {
        digitalWrite(pins[row], bitRead(image[frame], row));          // displays according to dictionary
      }
      delayMicroseconds(timer1);                                              // delay between columns
    }
    for (row = 0; row < rows; row++)                                 // led clearing
    {
      digitalWrite(pins[row], LOW);
    }
   
}


//********** program pro bezdrátové ovládání *********//
 
void wireless()
{
  if(Bluetooth.available() > 0)           // controls if data are being received
{
  while(Bluetooth.available() > 0)        // reads data
  {
    msg += char(Bluetooth.read());        // coverts data  
    delay(150);                             // for accuracy
  }

  
  while(1==1)                            
  {
     int analogvalue = analogRead(A7);
     
   if(analogvalue >15)
   {
     before = before + 200;
     delayMicroseconds(before);
  for(data=0;data<=10;data++)             // displays 10 symbols
  {
    switch (msg[data])
    {
      
      case 'A':
      {show(A);
      break;}
      case 'B':
      {show(B);
      break;}
      case 'C':
      {show(C);
      break;}
      case 'D':
      {show(D);
      break;}
      case 'E':
      {show(E);
      break;}
      case 'F':
      {show(F);
      break;}
      case 'G':
      {show(G);
      break;}
      case 'H':
      {show(H);
      break;}
      case 'I':
      {show(I);
      break;}
      case 'J':
      {show(J);
      break;}
      case 'K':
      {show(K);
      break;}
      case 'L':
      {show(L);
      break;}
      case 'M':
      {show(M);
      break;}
      case 'N':
      {show(N);
      break;}
      case 'O':
      {show(O);
      break;}
      case 'P':
      {show(P);
      break;}
      case 'Q':
      {show(Q);
      break;}
      case 'R':
      {show(R);
      break;}
      case 'S':
      {show(S);
      break;}
      case 'T':
      {show(T);
      break;}
      case 'U':
      {show(U);
      break;}
      case 'V':
      {show(V);
      break;}
      case 'W':
      {show(W);
      break;}
      case 'X':
      {show(X);
      break;}
      case 'Y':
      {show(Y);
      break;}
      case 'Z':
      {show(Z);
      break;}
      
      case 'a':
      {show(a);
      break;}
      case 'b':
      {show(b);
      break;}
      case 'c':
      {show(c);
      break;}
      case 'd':
      {show(d);
      break;}
      case 'e':
      {show(e);
      break;}
      case 'f':
      {show(f);
      break;}
      case 'g':
      {show(g);
      break;}
      case 'h':
      {show(h);
      break;}
      case 'i':
      {show(i);
      break;}
      case 'j':
      {show(j);
      break;}
      case 'k':
      {show(k);
      break;}
      case 'l':
      {show(l);
      break;}
      case 'm':
      {show(m);
      break;}
      case 'n':
      {show(n);
      break;}
      case 'o':
      {show(o);
      break;}
      case 'p':
      {show(p);
      break;}
      case 'q':
      {show(q);
      break;}
      case 'r':
      {show(r);
      break;}
      case 's':
      {show(s);
      break;}
      case 't':
      {show(t);
      break;}
      case 'u':
      {show(u);
      break;}
      case 'v':
      {show(v);
      break;}
      case 'w':
      {show(w);
      break;}
      case 'x':
      {show(x);
      break;}
      case 'y':
      {show(y);
      break;}
      case 'z':
      {show(z);
      break;}
      
      case '0':
      {show(zero);
      break;}
      case '1':
      {show(one);
      break;}
      case '2':
      {show(two);
      break;}
      case '3':
      {show(three);
      break;}
      case '4':
      {show(four);
      break;}
      case '5':
      {show(five);
      break;}
      case '6':
      {show(six);
      break;}
      case '7':
      {show(seven);
      break;}
      case '8':
      {show(eight);
      break;}
      case '9':
      {show(nine);
      break;}
      case ' ':
      {show(space);
      break;}
      case '.':
      {show(fullstop);
      break;}
      case ':':
      {show(colon);
      break;}
      case '!':
      {show(exa);
      break;}
      case ',':
      {show(comma);
      break;}
      case '@':
      {show(heart);
      break;}
      case '#':
      {show(all);
      break;}
       
      
    }
    delayMicroseconds(timer2);                                    // delay between symbols
  }
  }

  if (Bluetooth.available())                          // display clearing function
  {
  BluetoothData=Bluetooth.read();
  if (BluetoothData=='*')                             // clears diaplys if receives "*"
  { 
    before = 0;
    for (row = 0; row < rows; row++)
    {
      digitalWrite(pins[row], LOW); 
    }
    msg="";                                           // clears msg
    break;
  }
  else
 
   {
    msg += char(BluetoothData);          
    delay(3);      
    
   }
    
   
  }
}
}
}

//****************************************** Konec ****************************************//

Another thing i noticed: It always resets at the same spot no matter how fast the text is scrolling and that's when i't halfway through the circle( it's a cylindrical display)