DC Motors with push buttons working Async

I am very new to arduino and I am working on a solution for a model rail road operating the switch machines with a single push button. I have come up with a simple solution that works but each motor needs to complete its run before the second begins. For example you push button A to run the switch motor and another operator selects B to run another switch motor. I would like to get the code to run asynchronous, so that user b does not have to wait for a to complete his request.

Attached is my Sketch file

#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include “utility/Adafruit_MS_PWMServoDriver.h”

Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_DCMotor *myMotor = AFMS.getMotor(1);
Adafruit_DCMotor *myMotor2 = AFMS.getMotor(2);
#define pushButtonPin 2
#define pushButtonPin2 3
int buttonPushed = 0;
int buttonState = 1;
int buttonPushed2 = 0;
int buttonState2 = 1;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
AFMS.begin();
pinMode(pushButtonPin, INPUT_PULLUP);
pinMode(pushButtonPin2, INPUT_PULLUP);
Serial.println("DC Motor Button ");
}

void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(pushButtonPin) == LOW) {
buttonPushed = 1;
if ( buttonPushed ) {
if (buttonState)
{
Serial.print("\n button pushed = " + buttonPushed );
Serial.print("\n button state = “+ buttonState );
myMotor->setSpeed(200);
myMotor->run(FORWARD);
Serial.print(“forward \n”);
delay(2500);
myMotor->run(RELEASE);
buttonState = 0;
} else {
Serial.print(”\n button state = " + buttonState );
myMotor->setSpeed(200);
myMotor->run(BACKWARD);
Serial.print(“backwards \n”);
delay(2500);
myMotor->run(RELEASE);
buttonState = 1;
}
}
}
if (digitalRead(pushButtonPin2) == LOW) {
buttonPushed2 = 1;

if ( buttonPushed2 ) {
if (buttonState2)
{
Serial.print("\n button pushed = " + buttonPushed2 );
Serial.print("\n button state = “+ buttonState2 );
myMotor2->setSpeed(200);
myMotor2->run(FORWARD);
Serial.print(“forward \n”);
delay(2500);
myMotor2->run(RELEASE);
buttonState2 = 0;
} else {
Serial.print(“button state = " + buttonState2 );
myMotor2->setSpeed(200);
myMotor2->run(BACKWARD);
Serial.print(”\n backwards \n”);
delay(2500);
myMotor2->run(RELEASE);
buttonState2 = 1;
}

// delay(2000);
}
}
}

adifruitmotorsheald-2-2.ino (509 Bytes)

Non-blocking timing tutorials:
Several things at a time.
Beginner's guide to millis().
Blink without delay().

Read the how to use this forum-please read sticky to see how to properly post code. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.