       //discard anything more than one char long
       while (Serial.available() > 0) 
         Serial.read();
-      
-      Serial.print("You typed: ");
-      Serial.println(rx_byte);
       
       switch(rx_byte)
       {

        break;
        
        case '1':
          Serial.print(F("Case 1\n"));
          
        break;
        
        case '2':
          Serial.print(F("Case 2\n"));
          
        break;
        
        default:

}


//helper function cause I use this too much
void clearSerialBuf()
{
  //discard anything within the buffer
  while (Serial.available() > 0) 
    Serial.read();
}


CAN_message_t setupMCMessage(uint8_t regID, uint8_t buf1 = 0x00, uint8_t buf2 = 0x00, bool stopPolling = false)
{
  CAN_message_t tx;

  tx.ext = 0;
  tx.id = 0x201;
  tx.len = 3;
  
  if(regID == REG_READ)
  {
    //performing a read operation set buf[0] to READ command
    tx.buf[0] = REG_READ;
    tx.buf[1] = buf1;
    
    //default is 0 but can represent time (in ms) for polling
    tx.buf[2] = buf2;

    //deactivates polling
    if(stopPolling)
    {
      tx.buf[2] = REG_HALTPOLL;
    }
  }
  else
  {
    //performing write opration
    tx.buf[0] = regID;

    //storing the value in byte flipped order
    tx.buf[2] = buf1;
    tx.buf[1] = buf2;
  }

  return tx;
}


CANClass CANMessage;

//End CAN stufffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff


//confirmation message from user
bool confirmPopUp(CAN_message_t message)
{
  bool feedback = false;
  bool waitingOnUser = true;

  clearSerialBuf();

  Serial.print(F("\nAre you sure you want to send: \n"));
  Serial.print("ID: ");
  Serial.print(message.id, HEX);

  //Print regID from buf[0]
  Serial.print(" RegID: ");
  Serial.print(message.buf[0], HEX);

  //Print value from register in reverse byte order
  Serial.print(" Data: ");
  Serial.print(message.buf[2], HEX);
  Serial.print(" ");
  Serial.print(message.buf[1], HEX);
  
  Serial.print(F("\ny/n?\n"));
  

  while(waitingOnUser)
  {
    if (Serial.available() > 0) 
    {
      rx_byte = Serial.read();
  
      //discard anything more than one char long
      clearSerialBuf();
      
      switch(rx_byte)
      {
        case '0':
        case 'N':
        case 'n':
          feedback = false;
          //No long waiting on user
          waitingOnUser = false;
        break;
        
        case '1':
        case 'Y':
        case 'y':
          feedback = true;
          //No long waiting on user
          waitingOnUser = false;
        break;

        default:
          Serial.print(F("Invalid syntax\n"));
          Serial.print(F("\ny/n?\n"));
        break;
      }
    }
  }
  
  return feedback;
}


//TODO: WORK ON THIS///////////////////////////////////
void setMCReg()
{
  bool caseSetMCReg = true;
  uint8_t regID;
  uint16_t value = 0x0000;

  
  //discard anything more than one char long from prev call
  clearSerialBuf();
  
  Serial.print(F(setMCRegMenu));
  Serial.print("\n");
  while(caseSetMCReg)
  {
    if (Serial.available() > 0) 
    {
      rx_byte = Serial.read();
  
      //discard anything more than one char long
      clearSerialBuf();
      
      switch(rx_byte)
      {
        case '0':
          Serial.print(F("CAN Menu\n"));
          caseSetMCReg = false;
        break;
        
        case '1':
          Serial.print(F("REG_SPEEDVAL\n"));
          regID = REG_SPEEDVAL;
        break;
        
        case '2':
          Serial.print(F("REG_SPEEDLIM\n"));
          regID = REG_SPEEDLIM;
        break;

        case '3':
          Serial.print(F("REG_VAR1\n"));
          regID = REG_VAR1;
        break;

        case '4':
          Serial.print(F("REG_VAR2\n"));
          regID = REG_VAR2;
        break;

        case '5':
          Serial.print(F("REG_VAR3\n"));
          regID = REG_VAR3;
        break;

        case '6':
          Serial.print(F("REG_VAR4\n"));
          regID = REG_VAR4;
        break;

        case '7':
          Serial.print(F("REG_MTEMPLIM\n"));
          regID = REG_MTEMPLIM;
        break;
        
        default:
          Serial.print(F("Invalid syntax\n"));
          Serial.print(F(setMCRegMenu));
        break; 
      }

      if(caseSetMCReg)
      {
        CAN_message_t txMessage = setupMCMessage(regID, (value && 0xFF00), (value && 0x00FF));  

        //send message if the user confirms they want to send it
        if(confirmPopUp(txMessage))
          Serial.print(F("\nNothing sent :) (WIP)\n"));
          //Can0.write(txMessage);

        Serial.print(F(setMCRegMenu));
      }
      
      Serial.print("\n");
    }
  }
}


//user interaction for reading registers over CAN
void readMCReg()
{
  bool caseReadMCReg = true;

  //register that the user chooses to read
  uint8_t regID;

  //discard anything more than one char long from prev call
  clearSerialBuf();
  
  Serial.print(F(readMCRegMenu));
  Serial.print("\n");
  while(caseReadMCReg)
  {
    if (Serial.available() > 0) 
    {
      rx_byte = Serial.read();
  
      //discard anything more than one char long
      clearSerialBuf();
      
      
      switch(rx_byte)
      {
        case '0':
          Serial.print(F("CAN Menu\n"));
          caseReadMCReg = false;
        break;
        
        case '1':
          Serial.print(F("REG_ERROR\n"));
          regID = REG_ERROR;
        break;
        
        case '2':
          Serial.print(F("REG_STATE\n"));
          regID = REG_STATE;
        break;

        case '3':
          Serial.print(F("REG_DPORT\n"));
          regID = REG_DPORT;
        break;

        case '4':
          Serial.print(F("REG_RUN\n"));
          regID = REG_RUN;
        break;

        case '5':
          Serial.print(F("REG_BTB\n"));
          regID = REG_BTB;
        break;

        case '6':
          Serial.print(F("REG_GO\n"));
          regID = REG_GO;
        break;

        case '7':
          Serial.print(F("REG_HVBUS\n"));
          regID = REG_HVBUS;
        break;

        case '8':
          Serial.print(F("REG_SPEEDLIM\n"));
          regID = REG_SPEEDLIM;
        break;

        case '9':
          Serial.print(F("REG_SPEEDRN\n"));
          regID = REG_SPEEDRN;
        break;

        case 'A':
          Serial.print(F("REG_TEMPM\n"));
          regID = REG_TEMPM;
        break;

        case 'B':
          Serial.print(F("REG_TEMPAIRMC\n"));
          regID = REG_TEMPAIRMC;
        break;
        
        default:
          Serial.print(F("Invalid syntax\n"));
          Serial.print(F(readMCRegMenu));
        break; 
      }
   
      if(caseReadMCReg)
      {
        CAN_message_t txMessage = setupMCMessage(REG_READ, regID);  

        //send message if the user confirms they want to send it
        if(confirmPopUp(txMessage))
          Can0.write(txMessage);

        Serial.print(F(readMCRegMenu));
      }

      Serial.print("\n");
    }
  }
}


//CAN option stuff here called from case 1
void case1()
{
  bool caseCAN = true;
  
  //discard anything more than one char long
  clearSerialBuf();

  //printing the options of CAN to the user
  Serial.print(F(menuCAN));
  Serial.print("\n");
  while(caseCAN)
