 }
 
 // adjust color with a decrement
-uint32_t adjustColor(uint32_t c, int adj) {
+uint32_t adjustColor(uint32_t c, unsigned long ttl) {
   // pull out RGB elements
   uint8_t cv[3];
   signed int cvl[3];
   extractColor(c, cv);
-
+  int adj;
+  
   // for each color
   for ( uint8_t i = 0; i < 3; i++ ) {
-    if( cv[i]>= adj ) { // unsiged stuff.  take care.
+    
+    // try to smoothly drop the colors
+    if( i==0 ) adj=RED_MAX/(RIM_LED_TTL/RIM_UPDATE);
+    else if( i==1 ) adj=GRN_MAX/(RIM_LED_TTL/RIM_UPDATE);
+    else adj=BLU_MAX/(RIM_LED_TTL/RIM_UPDATE);
+    
+    if ( cv[i] >= adj + LED_OFF ) { // unsiged stuff.  take care.
       cv[i] = cv[i] - adj;
     } else {
-      cv[i] = 0;
-    }
-//    Serial << cv[i] << endl;
-  }
-  
-//  while(1);
+      cv[i] = LED_OFF;
+    }
+    //    Serial << cv[i] << endl;
+  }
+
+  //  while(1);
   // repack and return
   return ( packColor(cv) );
 }

// RIM of LEDs
#define RIM_PIN 6 // wire to rim DI pin.  Include a 330 Ohm resistor in series.
#define RIM_N 85 // best if divisible by 4
#define RIM_DECAY_RATE 1 // reduce intensity at each update
#define RIM_UPDATE 100UL // update the automata on the rim at this interval

// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)

  cv[2] = (c << 24) >> 24;
}
uint32_t packColor(uint8_t * cv) {
  return ( rimJob.Color(cv[0], cv[1], cv[2]) );
}
void printColor(uint32_t c) {
  // pull out RGB elements
