 void loop ()
 {
   int countSum = 0;
-  int IntervalNumber =0;
+  
   TimeMsStart = millis();
-  while ((millis() - TimeMsStart) <= CountTime)
+  while ((millis() - TimeMsStart) <= CountTime)// for 1 second
   {
-    if (digitalRead(photogate)==HIGH) 
+    if (digitalRead(rad)==HIGH) 
     { 
       digitalWrite(LEDpin, HIGH);// turn on LED
-      countSum ++;
-      while(digitalRead(photogate)==HIGH);
-      digitalWrite(LEDpin, LOW); //turn off LED
+      countSum ++;// adds a count
+      digitalWrite(LEDpin, LOW); //turn off LED so it has to be forced back on
      }
   }
 Serial.print(IntervalNumber);

/*
VernierRadiation (v 2014.09)
Monitors a Vernier Radiation Monitor connected to BTD connector.

The sketch sums the Radiation Monitor Counts in the period "CountTime". 
The default CountTime is 1 second.

See www.vernier.com/arduino for more information.
 */
unsigned long TimeMsStart = 0;
int rad = 2; // Pin assignment for radiation monitor
int LEDpin =13;/// line for LED to turn on when count is received.
int CountTime = 1000;// this is the total time between reported results
int IntervalNumber =0;// tracks how many 1 second intervals

void setup() 
{
