If within If

You can cascade IF statements - something like

if buttonA is pressed {
    if something happens {
       do stuff
    }
    else {
       do other stuff
    }
}

if buttonB is pressed {
   // etc

This style can often make the relationships more obvious.

You might also want to consider the other order - something like this

if something happens {
   if buttonA is pressed {
      do stuff
   }
   else if buttonB is pressed {
      do xyz
   }
}
else {
 // etc

...R