Store Multiple Digit Input from Keypad

I've been looking for a solution for being able to enter multiple digit numbers and convert them into integer. I found a piece of code form PaulS but it does not work properly. Whatever number I enter with the delimiters I get '0' back on the serial monitor. The code:

char inData[10];
int index;
boolean started = false;
boolean ended = false;

void setup(){
  Serial.begin(9600);
  Serial.println("ready");
}

void loop()
{
  while(Serial.available() > 0)
  {
    char aChar = Serial.read();
    if(aChar == '>')
    {
      started = true;
      index = 0;
      inData[index] = '\0';
    }
    else if(aChar == '<')
    {
      ended = true;
    }
    else if(started)
    {
      inData[index] = aChar;
      index++;
      inData[index] = '\0';
    }
  }

  if(started && ended)
  {
    // Convert the string to an integer
    int inInt = atoi(inData);

    Serial.println(inInt);

    // Get ready for the next time
    started = false;
    ended = false;

    index = 0;
    inData[index] = '\0';
  }
}