     }
 }
 
-void reportTimeBased()
-{
-    for(int i=0; i<MAX_RACERS; i++) {
-        values[i] = digitalRead(sensorPins[i]);
-
-        if(mockMode){
-            values[i] = LOW;
-            if(currentTimeMillis - lastUpdateMillis > updateInterval) {
-                racerTicks[i] += i;
-                values[i] = HIGH;
-            }
-        }
-        
-        if(values[i] == HIGH && previoussensorValues[i] == LOW){
-            racerTicks[i]++;
-        }
-        previoussensorValues[i] = values[i];
-    }
-
+void checkTimeBased()
+{
     if(currentTimeMillis > raceLengthSecs * 1000){
         raceStarted = false;
         // print all racers

        }
        if(lastCountDown == 0) {
            raceStart();
            raceStarting = false;
            raceStarted = true;

            for(int i=0; i<MAX_RACERS; i++) {
                racerTicks[i] = 0;
                racerFinishTimeMillis[i] = 0;
            }

            digitalWrite(racer0GoLedPin,HIGH);
            digitalWrite(racer1GoLedPin,HIGH);
            digitalWrite(racer2GoLedPin,HIGH);
            digitalWrite(racer3GoLedPin,HIGH);
        }
    }
    if (raceStarted) {
        currentTimeMillis = millis() - raceStartMillis;

        if(bRaceTypeDistance == true){
            reportDistanceBased();
        }else{
            reportTimeBased();
        }

        printStatusUpdate();
    }    
}

void reportDistanceBased()
{
    bool bFinished = true;
    for(int i=0; i<MAX_RACERS; i++) {
        values[i] = digitalRead(sensorPins[i]);

        if(mockMode){
            values[i] = LOW;
            if(currentTimeMillis - lastUpdateMillis > updateInterval) {
                racerTicks[i] += i;
                values[i] = HIGH;
            }
        }

        if(values[i] == HIGH && previoussensorValues[i] == LOW){
            racerTicks[i]++;
            if(racerFinishTimeMillis[i] == 0 && racerTicks[i] >= raceLengthTicks) {
                racerFinishTimeMillis[i] = currentTimeMillis;
                Serial.print(i);
                Serial.print("F:");
                Serial.println(racerFinishTimeMillis[i], DEC);
                digitalWrite(racer0GoLedPin+i,LOW);
            }
        }
        if(racerFinishTimeMillis[i] == 0){
            bFinished = false;
        }
        previoussensorValues[i] = values[i];
    }

    if(bFinished == true){

int raceLengthSecs = 60;
int previousFakeTickMillis = 0;

int updateInterval = 10;
unsigned long lastUpdateMillis = 0;

//float mockSpeedsKph[4] = {10.0, 20.0, 30.0, 40.0};
float mockSpeedsKph[4] = {40.0, 56.0, 48.0, 32.0};

bool bRaceTypeDistance = true;

void setup() 
