Some questions about Multiplexing and LED cube

Hey, I build an kinda LED cube on a breadboard (http://img651.imageshack.us/img651/1073/img0589f.jpg). all the cathodes on each level are connected ( pins 2-4 are level pins )
and each anode is connect to the same anode on a diffrent level ( pins 5-13 )

it work fine but there is some minor problem: The last led (number 9 on pin 13) is "HIGH" for just 1/9 of the time that the first led is HIGH (pin 5), therefore that led is much darker. I used this (Arduino Reference - Arduino Reference) method to decrease the time of turning all LEDs off. I manged to get it to be exectuted in 200Microseconds ( when time = 1 )

Am i doing it right, or there is a more efficient way to do this?

Look at the code over here:

boolean led[3][3][3]; // led cube
int l,x,y,i; // l-level 

void setup() {                

  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
  
  for(l=0;l<3;l++) for(y=0;y<3;y++) for(x=0;x<3;x++) { led[l][y][x] = LOW; } // set all to LOW
  
  for(y=0;y<3;y++) for(x=0;x<3;x++) { led[0][y][x] = HIGH; } // set level 0 to HIGH
  
}

void loop() {
  
   array_process(1);
   
}

void array_process(long time){


for(i=0;i<time;i++)  
 for(l=0;l<3;l++)
  {
    
   PORTD =  B00011100; // Pins 2-4 => HIGH | Pins 5-7 LOW
   PORTB =  B00000000; // Pins 8-12 LOW

   if( l == 0 )
    {
    digitalWrite(2,LOW); // set 1st level catoda to low
    for(y=0;y<3;y++)
      for(x=0;x<3;x++)
         digitalWrite((5+x+y*3),led[l][y][x]); // pin 5 is the first led
    }
    
   if( l == 1 )
    {
    digitalWrite(3,LOW);
    for(y=0;y<3;y++)
      for(x=0;x<3;x++)
        digitalWrite((5+x+y*3),led[l][y][x]); 
    }
    
   if( l == 2 )
    {
    digitalWrite(4,LOW);
    for(y=0;y<3;y++)
      for(x=0;x<3;x++)
        digitalWrite((5+x+y*3),led[l][y][x]);
    }
   
     
  }
     
}

I found a solution, This method calculate what should be display once and then display it(rather than calculation it each time).

byte pows[] = {1, 2, 4, 8, 16, 32, 64, 128};

void array_process(unsigned int time){

byte D[3],B[3];  

D[0] = B00011000;
B[0] = B00000000;

D[1] = B00010100;
B[1] = B00000000;

D[2] = B00001100;
B[2] = B00000000;

Serial.println(B[l],DEC);

for(l=0;l<3;l++)    
  for(y=0;y<3;y++)
    for(x=0;x<3;x++){
      if ( y == 0 ) { if( led[l][y][x] == HIGH ) D[l] += pows[5+x]; }
      else { if( led[l][y][x] == HIGH ) B[l] += pows[x+(y*3)-3]; } }

for(i=0;i<time;i++)
  for(l=0;l<3;l++)
    {
     PORTD = D[l];
     PORTB = B[l];
     delayMicroseconds(100); 
     PORTD = B00011100;
     PORTB = B00000000;  
    }

}