using gsm module for access control

ok guys... working though and need some help. I have this code running in my loop, and my goal is to

  1. when the gsm receives a text on myserial2 the code checks for the index, opens the message with cmgr and then checks the body for a "yes" or "no" as message body.
  2. based on that it runs 2 possible processes.
  3. it ends by deleting all messages with at+cmdl 1,4

I know I only have the very beginning, but am hoping there may be a better way. right now this is in my main loop....

   while(mySerial2.available() > 0){
     inCharModem = mySerial2.read();
      if (indexModem < 5){
         if (inCharModem == '+'){    
           indexModem = 0;
         }
         
         inDataModem[indexModem] = inCharModem;
         indexModem++;
         inDataModem[indexModem] = '\0';
       }
     
     else
       {
         indexModem = 0;
         Serial.write(mySerial2.read());
       }
   }
       if(strcmp(inDataModem,"+CMTI")==0) { indexModem = 0; mySerial2.println("AT+CMGR=7"); }
}