 
 // A theater chase where packets switch directions every once in a while
 void theater_chase_bounce() {
-  static uint8_t pal_index = 0;
-  static uint8_t last_index;
+  static uint8_t pal_index = 0;  
   static uint8_t bpm = map(analogRead(RATE_POT), 0 , 1253, 60, 20);
+
+  // Some variables to help us smoothly transition between rates
+  static uint8_t last_index = 0;
+  static uint8_t last_second = 99;
+  uint8_t second = (millis()/1000)%60;
 
   // Update lead LED position at an input dependent rate
   last_index = pal_index;
-  pal_index = beatsin8(bpm);
-
-  if( pal_index == 1 && (last_index - pal_index) < 0) {
+  pal_index = beatsin8(bpm, 0, 255);
+
+  if( pal_index == 127 && (last_index - pal_index) < 0 && second != last_second) {
+    last_second = second;
     bpm = map(analogRead(RATE_POT), 0 , 1253, 60, 20);
   }
   

  random16_add_entropy(analogRead(5));

  // Setup strands of LED
  FastLED.addLeds<NEOPIXEL, LED_IN>(leds, numLED);
  FastLED.setBrightness(maxBrightness);
  FastLED.show();


volatile boolean palette_autopilot = false; // Flag for auto cycling palettes
volatile uint8_t gAnimCounter; // Counter for animation
volatile boolean anim_autopilot = false; // Flag for auto cycling animations
volatile boolean anim_reverse = false; // Flag for running animations in reverse
volatile boolean dj_control = false; // Flag if dj is controlling animations
volatile boolean run_strobe = false; // Flag for strobe interrupt animation
volatile boolean run_blackout = false; // Flag for blackout animation
volatile boolean run_whiteout = false; // Flag for whiteout animation


// Setup and global variable delcaration for palettes
CRGBPalette16 gPalette;
