Speratic Operation

Are your digitalRead() calls returning the values you expect according to the switch positions? Since the code you posted doesn't tell you, you probably don't know; Serial.print statements to print out the values would let you find out.