   for (int i = 0; i <= LASTPORT; i++) {
     if(analogRead(i) > THRESHOLD) {
 #ifndef WIND
-      if (lastNote != i) {
+      if (!(lastNote & (inttomask(i)))) {
 #endif
         // Beam has been cut
         // i+1 is because i is 0 indexed, but the ID starts with 1
-        if (i < 4) {
-          musicOn(i + 1);
+        musicOn(i + 1);
 #ifndef WIND
-          lastNote = i;
-#endif
-        } else if (i == 4) {
-#ifndef WIND
-          if (lastNote != 314) {
-#endif
-            if (noteSet == 1) {
-              noteSet = 2;
-            } else {
-              noteSet = 1;
-            }
-#ifndef WIND
-            lastNote = 314;
-          }
-#endif
-        }
-#ifndef WIND
+        lastNote |= (inttomask(i));
       }
 #endif
     } else {
 #ifndef WIND
       if (lastNote == i) {
-        lastNote = -1;
+        lastNote &= ~(inttomask(i));
       }
 #endif
       // Hand is gone. Stop the sound

 * playing laser, which will cause the Arduino to ignore the laser
 * until it is released again, thus preventing multiple hits */
// TODO: Switch to a bit flag, and support multiple strings
int lastNote = -1;

void setup()
{

int note2 = 0x3E;
int note1 = 0x3C;

uint8_t laser1 = 0x01;
uint8_t laser2 = 0x02;
uint8_t laser3 = 0x04;
uint8_t laser4 = 0x08;
uint8_t laser5 = 0x10;
uint8_t laser6 = 0x20;
uint8_t laser7 = 0x40;
uint8_t laser8 = 0x80;

// Variable to keep track of which set of notes (lower or upper 4)
// Needed to work around limited lasers
int noteSet = 1;
