trying to add a pushbutton to my circuit please help me

still going wrong somewhere added pushbutton circuit and getting error saying registrywrite not declared in this scope, can you help

[code]



//DECLARING SOME VARIABLES

//Pin connected to ST_CP of 74HC595
int latchPin = 9;
//Pin connected to SH_CP of 74HC595
int clockPin = 10;
////Pin connected to DS of 74HC595
int dataPin = 8;


const int buttonPin = 2;

int buttonPushCounter = 0;// counter for the number of button presses
int buttonState = 0;// current state of the button
int lastButtonState = 0;// previous state of the button


bool registerArray1 = LOW;
bool registerArray2 = LOW;
bool registerArray3 = LOW;
bool registerArray4 = LOW;
bool registerArray5 = LOW;
bool registerArray6 = LOW;
bool registerArray7 = LOW;
bool registerArray8 = LOW;


void setup() {
  Serial.begin ( 9600 );           //Enable the Serial Monitor
  Serial.println ( "Starting.." );   //Write someting



  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
pinMode(buttonPin, INPUT_PULLUP);

}

void loop() {

buttonState = digitalRead(buttonPin);
 if (buttonState != lastButtonState)
 {
 if (buttonState == LOW)
 {
 buttonPushCounter++;
}
lastButtonState = buttonState;
 }
switch (buttonPushCounter)
{
 case 1:
// callsequence one

    registerWrite(0, HIGH); // turn far right led on
    registerWrite(15, HIGH); // Turn far left led on
    delay(50); // wait 50 milliseconds

    registerWrite(0, LOW); // Turn first set of leds off
    registerWrite(15, LOW);

    registerWrite(1, HIGH);// and repeat for LED 4 to 13
    registerWrite(14, HIGH);
    delay(50);

    registerWrite(1, LOW);
    registerWrite(14, LOW);

    registerWrite(2, HIGH);
    registerWrite(13, HIGH);
    delay(50);

    registerWrite(2, LOW);
    registerWrite(13, LOW);

    registerWrite(3, HIGH);
    registerWrite(12, HIGH);
    delay(50);

    registerWrite(3, LOW);
    registerWrite(12, LOW);

    registerWrite(4, HIGH);
    registerWrite(11, HIGH);
    delay(50);

    registerWrite(4, LOW);
    registerWrite(11, LOW);

    registerWrite(5, HIGH);
    registerWrite(10, HIGH);
    delay(50);

    registerWrite(5, LOW);
    registerWrite(10, LOW);

    registerWrite(6, HIGH);
    registerWrite(9, HIGH);
    delay(50);

    registerWrite(6, LOW);
    registerWrite(9, LOW);

    registerWrite(7, HIGH);
    registerWrite(8, HIGH);
    delay(50);

    registerWrite(7, LOW);
    registerWrite(8, LOW);    // turn central led off after delay
    delay(50); // then delay off time

    registerWrite(8, HIGH);   // turn central led back on for phaser fire
    delay(1000);// then hold on for set time as phaser fires

    registerWrite(8, LOW);  // then turn off central led
break;

case 2:
 // callsequence two
break;
case 3:
 // callsequence three
break;
 case 4:
//reset button push counter after 3 sequences. Zero is is the idle state
buttonPushCounter = 0;
break;
 
}

  void registerWrite(int PIN, bool BOOL) {
    //Writer to the 8 bit register, PIN - Pin No, BOOL - Status HIGH or LOW

    //Update the saved outputs bits
    if (PIN == 1)  {
      registerArray1 = BOOL;
    }
    if (PIN == 2)  {
      registerArray2 = BOOL;
    }
    if (PIN == 3)  {
      registerArray3 = BOOL;
    }
    if (PIN == 4)  {
      registerArray4 = BOOL;
    }
    if (PIN == 5)  {
      registerArray5 = BOOL;
    }
    if (PIN == 6)  {
      registerArray6 = BOOL;
    }
    if (PIN == 7)  {
      registerArray7 = BOOL;
    }
    if (PIN == 8)  {
      registerArray8 = BOOL;
    }

    //Shift Register the statuses
    //Starting with last array so that the first array gets to the first pin.
    if (registerArray8 == HIGH) {
      shiftOn();
    } else {
      shiftOff();
    }
    if (registerArray7 == HIGH) {
      shiftOn();
    } else {
      shiftOff();
    }
    if (registerArray6 == HIGH) {
      shiftOn();
    } else {
      shiftOff();
    }
    if (registerArray5 == HIGH) {
      shiftOn();
    } else {
      shiftOff();
    }
    if (registerArray4 == HIGH) {
      shiftOn();
    } else {
      shiftOff();
    }
    if (registerArray3 == HIGH) {
      shiftOn();
    } else {
      shiftOff();
    }
    if (registerArray2 == HIGH) {
      shiftOn();
    } else {
      shiftOff();
    }
    if (registerArray1 == HIGH) {
      shiftOn();
    } else {
      shiftOff();
    }

    //Latch Outputs
    //This will shift the statuses of to the pins
    digitalWrite(latchPin, HIGH);
    digitalWrite(latchPin, LOW);
  }


  void shiftOn() {
    //ON - Shift with the status ON
    //     Serial.println ( "Sent On" );
    digitalWrite(dataPin, HIGH);
    digitalWrite(clockPin, HIGH);
    digitalWrite(clockPin, LOW);
    digitalWrite(dataPin, LOW);
    //  delay(10);
  }

  void shiftOff() {
    //OFF - Shift with the status OFF
    //     Serial.println ( "Sent Off" );
    digitalWrite(dataPin, LOW);
    digitalWrite(clockPin, HIGH);
    digitalWrite(clockPin, LOW);
    digitalWrite(dataPin, LOW);
    //  delay(10);
  }

[/code]