diff --git a/Builds/MacOSX/open-ephys.xcodeproj/project.xcworkspace/xcuserdata/Josh.xcuserdatad/UserInterfaceState.xcuserstate b/Builds/MacOSX/open-ephys.xcodeproj/project.xcworkspace/xcuserdata/Josh.xcuserdatad/UserInterfaceState.xcuserstate
index 784180ac5ef0387151381407e91c9d47091df3eb..e4adefc948629c5ca1756c4b6c9afd5595d188ac 100755
Binary files a/Builds/MacOSX/open-ephys.xcodeproj/project.xcworkspace/xcuserdata/Josh.xcuserdatad/UserInterfaceState.xcuserstate and b/Builds/MacOSX/open-ephys.xcodeproj/project.xcworkspace/xcuserdata/Josh.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/Source/Processors/ChannelMappingNode.cpp b/Source/Processors/ChannelMappingNode.cpp
index 536d47bdede43795d95a3933dd9c401b06ca8fca..61fa6c81b0f7b7ce0a9e2e2308197847bed42d61 100644
--- a/Source/Processors/ChannelMappingNode.cpp
+++ b/Source/Processors/ChannelMappingNode.cpp
@@ -30,14 +30,14 @@
 ChannelMappingNode::ChannelMappingNode()
     : GenericProcessor("Channel Mapping"), channelBuffer(1,10000)
 {
-	referenceArray.resize(1024); // make room for 1024 channels
-	channelArray.resize(1024);
+    referenceArray.resize(1024); // make room for 1024 channels
+    channelArray.resize(1024);
 
-	for (int i = 0; i < referenceArray.size(); i++)
-	{
-		referenceArray.set(i, -1);
-		channelArray.set(i, i);
-	}
+    for (int i = 0; i < referenceArray.size(); i++)
+    {
+        referenceArray.set(i, -1);
+        channelArray.set(i, i);
+    }
 
 }
 
@@ -59,67 +59,68 @@ AudioProcessorEditor* ChannelMappingNode::createEditor()
 
 void ChannelMappingNode::updateSettings()
 {
-	if (getNumInputs() > 0)
-		channelBuffer.setSize(getNumInputs(), 10000);
+    if (getNumInputs() > 0)
+        channelBuffer.setSize(getNumInputs(), 10000);
 
 }
 
 
 void ChannelMappingNode::setParameter(int parameterIndex, float newValue)
 {
-    
+
     if (parameterIndex == 1)
     {
-    	referenceArray.set(currentChannel, (int) newValue);
-    } else
+        referenceArray.set(currentChannel, (int) newValue);
+    }
+    else
     {
-    	channelArray.set(currentChannel, (int) newValue);
+        channelArray.set(currentChannel, (int) newValue);
     }
 
 }
 
 void ChannelMappingNode::process(AudioSampleBuffer& buffer,
-                            MidiBuffer& midiMessages,
-                            int& nSamples)
+                                 MidiBuffer& midiMessages,
+                                 int& nSamples)
 {
 
-	// use copy constructor to set the data to refer to
-	channelBuffer = buffer;
+    // use copy constructor to set the data to refer to
+    channelBuffer = buffer;
 
-	// copy it back into the buffer according to the channel mapping
-	buffer.clear();
+    // copy it back into the buffer according to the channel mapping
+    buffer.clear();
 
-	for (int i = 0; i < buffer.getNumChannels(); i++)
-	{
-		buffer.addFrom(i, // destChannel
+    for (int i = 0; i < buffer.getNumChannels(); i++)
+    {
+        buffer.addFrom(i, // destChannel
                        0, // destStartSample
                        channelBuffer, // source
                        channelArray[i], // sourceChannel
                        0, // sourceStartSample
                        nSamples, // numSamples
                        1.0f // gain to apply to source (positive for original signal)
-                       );
+                      );
 
-	}
+    }
 
-	// now do the referencing
-	for (int i = 0; i < buffer.getNumChannels(); i++)
-	{
+    // now do the referencing
+    for (int i = 0; i < buffer.getNumChannels(); i++)
+    {
 
-		if (referenceArray[i] > -1)
-		{
+        if (referenceArray[i] > -1)
+        {
 
-			buffer.addFrom(i, // destChannel
-                       0, // destStartSample
-                       channelBuffer, // source
-                       referenceArray[i], // sourceChannel
-                       0, // sourceStartSample
-                       nSamples, // numSamples
-                       -1.0f // gain to apply to source (negative for reference)
-                       );
-		}
+            buffer.addFrom(i, // destChannel
+                           0, // destStartSample
+                           channelBuffer, // source
+                           referenceArray[i], // sourceChannel
+                           0, // sourceStartSample
+                           nSamples, // numSamples
+                           -1.0f // gain to apply to source (negative for reference)
+                          );
+        }
 
-	}
+    }
 
 }
 
diff --git a/Source/Processors/DataThreads/DataThread.cpp b/Source/Processors/DataThreads/DataThread.cpp
index 450e27b93133f386125000aba159730b0aff4bf4..aeebad2b5dde064a06294ed8b35b2e20758e80e3 100755
--- a/Source/Processors/DataThreads/DataThread.cpp
+++ b/Source/Processors/DataThreads/DataThread.cpp
@@ -31,8 +31,8 @@ DataThread::DataThread(SourceNode* s) : Thread("Data Thread"), dataBuffer(0)
     setPriority(10);
 
     timestamp = 0; // set default to zero, so that sources that
-                   // do not generate their own timestamps can simply increment
-                   // this value
+    // do not generate their own timestamps can simply increment
+    // this value
 
 }
 
diff --git a/Source/Processors/DataThreads/FPGAThread.cpp b/Source/Processors/DataThreads/FPGAThread.cpp
index 280ea4c2a6e9b51745032acd89cffb5e4e3a3db8..9f61020e96f6ade3d039e6b030db03b2203db660 100644
--- a/Source/Processors/DataThreads/FPGAThread.cpp
+++ b/Source/Processors/DataThreads/FPGAThread.cpp
@@ -316,7 +316,7 @@ bool FPGAThread::updateBuffer()
                 //             "     Bytes read: " << bytesToRead << std::endl;
             }
 
-            unsigned char timecode[6]; 
+            unsigned char timecode[6];
             timecode[0] = (pBuffer[j] >> 1) | ((pBuffer[j+1] >> 1) << 7); // 1st byte throw out last bit of each byte and just concatenate the other bytes in ascending order
             timecode[1] = (pBuffer[j+1] >> 2) | ((pBuffer[j+2] >> 1) << 6); // 2nd byte
             timecode[2] = (pBuffer[j+2] >> 3) | ((pBuffer[j+3] >> 1) << 5); // 3rd byte
diff --git a/Source/Processors/DataThreads/FileReaderThread.cpp b/Source/Processors/DataThreads/FileReaderThread.cpp
index 64fb0928f1eed716c25699927f564ff361dcf2ac..8461db153a6bc76cb24519400ec1df5d473ff862 100755
--- a/Source/Processors/DataThreads/FileReaderThread.cpp
+++ b/Source/Processors/DataThreads/FileReaderThread.cpp
@@ -143,7 +143,7 @@ bool FileReaderThread::updateBuffer()
             {
 
                 timestamp++; // = (0 << 0) + (0 << 8) + (0 << 16) + (0 << 24); // +
-                            //(4 << 32); // + (3 << 40) + (2 << 48) + (1 << 56);
+                //(4 << 32); // + (3 << 40) + (2 << 48) + (1 << 56);
 
                 //timestamp++; // = timer.getHighResolutionTicks();
                 dataBuffer->addToBuffer(thisSample, &timestamp, &eventCode, 1);
diff --git a/Source/Processors/DataThreads/RHD2000Thread.cpp b/Source/Processors/DataThreads/RHD2000Thread.cpp
index 66cbc03efba3cb614591831ea6863a23f6e1110c..da972f5da2ad949436ff2ff815617aec6db717e3 100644
--- a/Source/Processors/DataThreads/RHD2000Thread.cpp
+++ b/Source/Processors/DataThreads/RHD2000Thread.cpp
@@ -236,13 +236,13 @@ void RHD2000Thread::scanPorts()
         // Record delay settings that yield good communication with the chip.
         for (stream = 0; stream < MAX_NUM_DATA_STREAMS; ++stream)//MAX_NUM_DATA_STREAMS; ++stream)
         {
-           // std::cout << "Stream number " << stream << ", delay = " << delay << std::endl;
+            // std::cout << "Stream number " << stream << ", delay = " << delay << std::endl;
 
             id = deviceId(dataBlock, stream);
-            
+
             if (id > 0) // 1 = RHD2132, 2 = RHD2216
             {
-              //  std::cout << "Device ID found: " << id << std::endl;
+                //  std::cout << "Device ID found: " << id << std::endl;
 
                 sumGoodDelays.set(stream,sumGoodDelays[stream] + 1);
 
@@ -374,32 +374,32 @@ int RHD2000Thread::getNumChannels()
 
     for (int i = 0; i < MAX_NUM_DATA_STREAMS; i++)
     {
-    
+
         if (numChannelsPerDataStream[i] > 0)
         {
             numChannels += numChannelsPerDataStream[i];
             numChannels += 3; // to account for aux inputs
         }
 
-		
-		/*
-		if (chipRegisters->adcAux1En){ // no public function to read these? fix this in some way
-			numChannels += 1;
-		}
-		if (chipRegisters->adcAux2En){
-			numChannels += 1;
-		}
-		if (chipRegisters->adcAux3En){
-			numChannels += 1;
-		}
-		*/
-	}
+
+        /*
+        if (chipRegisters->adcAux1En){ // no public function to read these? fix this in some way
+        	numChannels += 1;
+        }
+        if (chipRegisters->adcAux2En){
+        	numChannels += 1;
+        }
+        if (chipRegisters->adcAux3En){
+        	numChannels += 1;
+        }
+        */
+    }
 
 
     if (acquireAdcChannels)
     {
         numChannels += 8; // add 8 channels for the ADCs
-    }        
+    }
 
     if (numChannels > 0)
         return numChannels;
@@ -414,7 +414,7 @@ void RHD2000Thread::updateChannelNames()
 
     for (int i = 0; i < MAX_NUM_DATA_STREAMS; i++)
     {
-    
+
         for (int j = 0; j < numChannelsPerDataStream[i]; j++)
         {
             chNum++;
@@ -427,17 +427,17 @@ void RHD2000Thread::updateChannelNames()
     {
         for (int i = 0; i < MAX_NUM_DATA_STREAMS; i++)
         {
-        
+
             for (int j = 0; j < 3; j++)
             {
-                
+
                 chNum++;
 
                 String chName = "AUX";
                 chName += (j+1);
 
-              // this is causing a seg fault for some reason:
-              //  sn->channels[chNum]->setName(chName);
+                // this is causing a seg fault for some reason:
+                //  sn->channels[chNum]->setName(chName);
             }
         }
     }
@@ -452,9 +452,9 @@ void RHD2000Thread::updateChannelNames()
             String chName = "ADC";
             chName += (j+1);
 
-          //  sn->channels[chNum]->setName(chName);
+            //  sn->channels[chNum]->setName(chName);
         }
-    }        
+    }
 
 }
 
@@ -471,7 +471,7 @@ float RHD2000Thread::getSampleRate()
 
 float RHD2000Thread::getBitVolts()
 {
-	return 0.195f;
+    return 0.195f;
 }
 
 double RHD2000Thread::setUpperBandwidth(double upper)
@@ -519,7 +519,7 @@ bool RHD2000Thread::enableHeadstage(int hsNum, bool enabled)
     for (int i = 0; i < MAX_NUM_DATA_STREAMS; i++)
     {
         std::cout << numChannelsPerDataStream[i] << " ";
-    } 
+    }
 
     std:: cout << std::endl;
 
@@ -549,15 +549,16 @@ void RHD2000Thread::assignAudioOut(int dacChannel, int dataChannel)
         audioOutputR = dataChannel;
 
 
-    } else if (dacChannel == 1)
+    }
+    else if (dacChannel == 1)
     {
         audioOutputL = dataChannel;
 
     }
 
     dacOutputShouldChange = true; // set a flag and take care of setting wires
-                                  // during the updateBuffer() method
-                                  // to avoid problems
+    // during the updateBuffer() method
+    // to avoid problems
 
 }
 
@@ -577,101 +578,102 @@ void RHD2000Thread::setSampleRate(int sampleRateIndex, bool isTemporary)
     {
         savedSampleRateIndex = sampleRateIndex;
     }
- 
+
     int numUsbBlocksToRead = 0; // placeholder - make this change the number of blocks that are read in RHD2000Thread::updateBuffer()
 
     Rhd2000EvalBoard::AmplifierSampleRate sampleRate; // just for local use
 
-    switch (sampleRateIndex) {
-    case 0:
-        sampleRate = Rhd2000EvalBoard::SampleRate1000Hz;
-        numUsbBlocksToRead = 1;
-        boardSampleRate = 1000.0f;
-        break;
-    case 1:
-        sampleRate = Rhd2000EvalBoard::SampleRate1250Hz;
-        numUsbBlocksToRead = 1;
-        boardSampleRate = 1250.0f;
-        break;
-    case 2:
-        sampleRate = Rhd2000EvalBoard::SampleRate1500Hz;
-        numUsbBlocksToRead = 1;
-        boardSampleRate = 1500.0f;
-        break;
-    case 3:
-        sampleRate = Rhd2000EvalBoard::SampleRate2000Hz;
-        numUsbBlocksToRead = 1;
-        boardSampleRate = 2000.0f;
-        break;
-    case 4:
-        sampleRate = Rhd2000EvalBoard::SampleRate2500Hz;
-        numUsbBlocksToRead = 1;
-        boardSampleRate = 2500.0f;
-        break;
-    case 5:
-        sampleRate = Rhd2000EvalBoard::SampleRate3000Hz;
-        numUsbBlocksToRead = 2;
-        boardSampleRate = 3000.0f;
-        break;
-    case 6:
-        sampleRate = Rhd2000EvalBoard::SampleRate3333Hz;
-        numUsbBlocksToRead = 2;
-        boardSampleRate = 3333.0f;
-        break;
-    case 7:
-        sampleRate = Rhd2000EvalBoard::SampleRate4000Hz;
-        numUsbBlocksToRead = 2;
-        boardSampleRate = 4000.0f;
-        break;
-    case 8:
-        sampleRate = Rhd2000EvalBoard::SampleRate5000Hz;
-        numUsbBlocksToRead = 3;
-        boardSampleRate = 5000.0f;
-        break;
-    case 9:
-        sampleRate = Rhd2000EvalBoard::SampleRate6250Hz;
-        numUsbBlocksToRead = 3;
-        boardSampleRate = 6250.0f;
-        break;
-    case 10:
-        sampleRate = Rhd2000EvalBoard::SampleRate8000Hz;
-        numUsbBlocksToRead = 4;
-        boardSampleRate = 8000.0f;
-        break;
-    case 11:
-        sampleRate = Rhd2000EvalBoard::SampleRate10000Hz;
-        numUsbBlocksToRead = 6;
-        boardSampleRate = 10000.0f;
-        break;
-    case 12:
-        sampleRate = Rhd2000EvalBoard::SampleRate12500Hz;
-        numUsbBlocksToRead = 7;
-        boardSampleRate = 12500.0f;
-        break;
-    case 13:
-        sampleRate = Rhd2000EvalBoard::SampleRate15000Hz;
-        numUsbBlocksToRead = 8;
-        boardSampleRate = 15000.0f;
-        break;
-    case 14:
-        sampleRate = Rhd2000EvalBoard::SampleRate20000Hz;
-        numUsbBlocksToRead = 12;
-        boardSampleRate = 20000.0f;
-        break;
-    case 15:
-        sampleRate = Rhd2000EvalBoard::SampleRate25000Hz;
-        numUsbBlocksToRead = 14;
-        boardSampleRate = 25000.0f;
-        break;
-    case 16:
-        sampleRate = Rhd2000EvalBoard::SampleRate30000Hz;
-        numUsbBlocksToRead = 16;
-        boardSampleRate = 30000.0f;
-        break;
-    default:
-        sampleRate = Rhd2000EvalBoard::SampleRate10000Hz;
-        numUsbBlocksToRead = 6;
-        boardSampleRate = 10000.0f;
+    switch (sampleRateIndex)
+    {
+        case 0:
+            sampleRate = Rhd2000EvalBoard::SampleRate1000Hz;
+            numUsbBlocksToRead = 1;
+            boardSampleRate = 1000.0f;
+            break;
+        case 1:
+            sampleRate = Rhd2000EvalBoard::SampleRate1250Hz;
+            numUsbBlocksToRead = 1;
+            boardSampleRate = 1250.0f;
+            break;
+        case 2:
+            sampleRate = Rhd2000EvalBoard::SampleRate1500Hz;
+            numUsbBlocksToRead = 1;
+            boardSampleRate = 1500.0f;
+            break;
+        case 3:
+            sampleRate = Rhd2000EvalBoard::SampleRate2000Hz;
+            numUsbBlocksToRead = 1;
+            boardSampleRate = 2000.0f;
+            break;
+        case 4:
+            sampleRate = Rhd2000EvalBoard::SampleRate2500Hz;
+            numUsbBlocksToRead = 1;
+            boardSampleRate = 2500.0f;
+            break;
+        case 5:
+            sampleRate = Rhd2000EvalBoard::SampleRate3000Hz;
+            numUsbBlocksToRead = 2;
+            boardSampleRate = 3000.0f;
+            break;
+        case 6:
+            sampleRate = Rhd2000EvalBoard::SampleRate3333Hz;
+            numUsbBlocksToRead = 2;
+            boardSampleRate = 3333.0f;
+            break;
+        case 7:
+            sampleRate = Rhd2000EvalBoard::SampleRate4000Hz;
+            numUsbBlocksToRead = 2;
+            boardSampleRate = 4000.0f;
+            break;
+        case 8:
+            sampleRate = Rhd2000EvalBoard::SampleRate5000Hz;
+            numUsbBlocksToRead = 3;
+            boardSampleRate = 5000.0f;
+            break;
+        case 9:
+            sampleRate = Rhd2000EvalBoard::SampleRate6250Hz;
+            numUsbBlocksToRead = 3;
+            boardSampleRate = 6250.0f;
+            break;
+        case 10:
+            sampleRate = Rhd2000EvalBoard::SampleRate8000Hz;
+            numUsbBlocksToRead = 4;
+            boardSampleRate = 8000.0f;
+            break;
+        case 11:
+            sampleRate = Rhd2000EvalBoard::SampleRate10000Hz;
+            numUsbBlocksToRead = 6;
+            boardSampleRate = 10000.0f;
+            break;
+        case 12:
+            sampleRate = Rhd2000EvalBoard::SampleRate12500Hz;
+            numUsbBlocksToRead = 7;
+            boardSampleRate = 12500.0f;
+            break;
+        case 13:
+            sampleRate = Rhd2000EvalBoard::SampleRate15000Hz;
+            numUsbBlocksToRead = 8;
+            boardSampleRate = 15000.0f;
+            break;
+        case 14:
+            sampleRate = Rhd2000EvalBoard::SampleRate20000Hz;
+            numUsbBlocksToRead = 12;
+            boardSampleRate = 20000.0f;
+            break;
+        case 15:
+            sampleRate = Rhd2000EvalBoard::SampleRate25000Hz;
+            numUsbBlocksToRead = 14;
+            boardSampleRate = 25000.0f;
+            break;
+        case 16:
+            sampleRate = Rhd2000EvalBoard::SampleRate30000Hz;
+            numUsbBlocksToRead = 16;
+            boardSampleRate = 30000.0f;
+            break;
+        default:
+            sampleRate = Rhd2000EvalBoard::SampleRate10000Hz;
+            numUsbBlocksToRead = 6;
+            boardSampleRate = 10000.0f;
     }
 
 
@@ -680,7 +682,7 @@ void RHD2000Thread::setSampleRate(int sampleRateIndex, bool isTemporary)
 
     std::cout << "Sample rate set to " << evalBoard->getSampleRate() << std::endl;
 
-     // Now that we have set our sampling rate, we can set the MISO sampling delay
+    // Now that we have set our sampling rate, we can set the MISO sampling delay
     // which is dependent on the sample rate.
     evalBoard->setCableLengthMeters(Rhd2000EvalBoard::PortA, cableLengthPortA);
     evalBoard->setCableLengthMeters(Rhd2000EvalBoard::PortB, cableLengthPortB);
@@ -691,7 +693,7 @@ void RHD2000Thread::setSampleRate(int sampleRateIndex, bool isTemporary)
 
 void RHD2000Thread::updateRegisters()
 {
-       // Set up an RHD2000 register object using this sample rate to
+    // Set up an RHD2000 register object using this sample rate to
     // optimize MUX-related register settings.
     chipRegisters.defineSampleRate(boardSampleRate);
 
@@ -722,18 +724,18 @@ void RHD2000Thread::updateRegisters()
 
     // Before generating register configuration command sequences, set amplifier
     // bandwidth paramters.
-     actualDspCutoffFreq = chipRegisters.setDspCutoffFreq(desiredDspCutoffFreq);
-     actualLowerBandwidth = chipRegisters.setLowerBandwidth(desiredLowerBandwidth);
-     actualUpperBandwidth = chipRegisters.setUpperBandwidth(desiredUpperBandwidth);
-     chipRegisters.enableDsp(dspEnabled);
+    actualDspCutoffFreq = chipRegisters.setDspCutoffFreq(desiredDspCutoffFreq);
+    actualLowerBandwidth = chipRegisters.setLowerBandwidth(desiredLowerBandwidth);
+    actualUpperBandwidth = chipRegisters.setUpperBandwidth(desiredUpperBandwidth);
+    chipRegisters.enableDsp(dspEnabled);
 
-     // turn on aux inputs
+    // turn on aux inputs
     chipRegisters.enableAux1(true);
     chipRegisters.enableAux2(true);
     chipRegisters.enableAux3(true);
 
-     chipRegisters.createCommandListRegisterConfig(commandList, true);
-        // Upload version with ADC calibration to AuxCmd3 RAM Bank 0.
+    chipRegisters.createCommandListRegisterConfig(commandList, true);
+    // Upload version with ADC calibration to AuxCmd3 RAM Bank 0.
     evalBoard->uploadCommandList(commandList, Rhd2000EvalBoard::AuxCmd3, 0);
     evalBoard->selectAuxCommandLength(Rhd2000EvalBoard::AuxCmd3, 0,
                                       commandSequenceLength - 1);
@@ -752,7 +754,7 @@ void RHD2000Thread::updateRegisters()
                                       commandSequenceLength - 1);
     chipRegisters.setFastSettle(false);
 
-    
+
 
     evalBoard->selectAuxCommandBank(Rhd2000EvalBoard::PortA, Rhd2000EvalBoard::AuxCmd3,
                                     fastSettleEnabled ? 2 : 1);
@@ -867,104 +869,108 @@ bool RHD2000Thread::updateBuffer()
     //cout << "Block size: " << blockSize << endl;
 
     bool return_code;
-	
 
-        if (evalBoard->numWordsInFifo() >= blockSize)
+
+    if (evalBoard->numWordsInFifo() >= blockSize)
+    {
+        return_code = evalBoard->readDataBlock(dataBlock);
+
+        for (int samp = 0; samp < dataBlock->getSamplesPerDataBlock(); samp++)
         {
-            return_code = evalBoard->readDataBlock(dataBlock);
+            int streamNumber = -1;
+            int channel = -1;
 
-            for (int samp = 0; samp < dataBlock->getSamplesPerDataBlock(); samp++)
+            // do the neural data channels first
+            for (int dataStream = 0; dataStream < MAX_NUM_DATA_STREAMS; dataStream++)
             {
-                int streamNumber = -1;
-                int channel = -1;
-
-                // do the neural data channels first
-                for (int dataStream = 0; dataStream < MAX_NUM_DATA_STREAMS; dataStream++)
+                if (numChannelsPerDataStream[dataStream] > 0)
                 {
-                    if (numChannelsPerDataStream[dataStream] > 0)
+                    streamNumber++;
+
+                    for (int chan = 0; chan < numChannelsPerDataStream[dataStream]; chan++)
                     {
-                        streamNumber++;
+                        //   std::cout << "reading sample stream" << streamNumber << " chan " << chan << " sample "<< samp << std::endl;
+                        channel++;
 
-                        for (int chan = 0; chan < numChannelsPerDataStream[dataStream]; chan++)
-                        {
-                         //   std::cout << "reading sample stream" << streamNumber << " chan " << chan << " sample "<< samp << std::endl;
-							channel++;
+                        int value = dataBlock->amplifierData[streamNumber][chan][samp];
 
-                            int value = dataBlock->amplifierData[streamNumber][chan][samp];
+                        thisSample[channel] = float(value-32768)*0.195f;
+                    }
 
-                            thisSample[channel] = float(value-32768)*0.195f;
-                        }
-					
-					}
+                }
 
-				}
+            }
 
-                streamNumber = -1;
+            streamNumber = -1;
 
-                // then do the ADC channels
-                for (int dataStream = 0; dataStream < MAX_NUM_DATA_STREAMS; dataStream++)
+            // then do the ADC channels
+            for (int dataStream = 0; dataStream < MAX_NUM_DATA_STREAMS; dataStream++)
+            {
+                if (numChannelsPerDataStream[dataStream] > 0)
                 {
-                    if (numChannelsPerDataStream[dataStream] > 0)
+                    streamNumber++;
+
+                    if (samp % 4 == 1)   // every 4th sample should have auxiliary input data
                     {
-                        streamNumber++;
 
-                        if (samp % 4 == 1) { // every 4th sample should have auxiliary input data
-                        
-                            channel++;
-                            thisSample[channel] = 0.0374 *
-                                 float(dataBlock->auxiliaryData[dataStream][1][samp+0]);
+                        channel++;
+                        thisSample[channel] = 0.0374 *
+                                              float(dataBlock->auxiliaryData[dataStream][1][samp+0]);
 
-                            auxBuffer[channel]=thisSample[channel];
+                        auxBuffer[channel]=thisSample[channel];
 
-                            channel++;
-                            thisSample[channel] = 0.0374 *
-                                 float(dataBlock->auxiliaryData[dataStream][1][samp+1]);
+                        channel++;
+                        thisSample[channel] = 0.0374 *
+                                              float(dataBlock->auxiliaryData[dataStream][1][samp+1]);
 
-                            auxBuffer[channel]=thisSample[channel];
+                        auxBuffer[channel]=thisSample[channel];
 
-                        
-                            channel++;
-                            thisSample[channel] = 0.0374 *
-                                 float(dataBlock->auxiliaryData[dataStream][1][samp+2]);
 
-                            auxBuffer[channel]=thisSample[channel];
+                        channel++;
+                        thisSample[channel] = 0.0374 *
+                                              float(dataBlock->auxiliaryData[dataStream][1][samp+2]);
 
-                        } else{ // repeat last values from buffer
+                        auxBuffer[channel]=thisSample[channel];
 
-                            channel++;
-                            thisSample[channel] = auxBuffer[channel];
-                            channel++;
-                            thisSample[channel] = auxBuffer[channel];
-                            channel++;
-                            thisSample[channel] = auxBuffer[channel];
-                        }
                     }
+                    else    // repeat last values from buffer
+                    {
 
+                        channel++;
+                        thisSample[channel] = auxBuffer[channel];
+                        channel++;
+                        thisSample[channel] = auxBuffer[channel];
+                        channel++;
+                        thisSample[channel] = auxBuffer[channel];
+                    }
                 }
 
-                // finally, loop through ADC channels if necessary
-                if (acquireAdcChannels)
+            }
+
+            // finally, loop through ADC channels if necessary
+            if (acquireAdcChannels)
+            {
+                for (int adcChan = 0; adcChan < 8; ++adcChan)
                 {
-                    for (int adcChan = 0; adcChan < 8; ++adcChan) {
-                    
+
                     channel++;
                     // ADC waveform units = volts
-                     thisSample[channel] = 
-                       0.000050354 * float(dataBlock->boardAdcData[adcChan][samp]);
-                    }
+                    thisSample[channel] =
+                        0.000050354 * float(dataBlock->boardAdcData[adcChan][samp]);
                 }
-				// std::cout << channel << std::endl;
+            }
+            // std::cout << channel << std::endl;
 
-				timestamp = dataBlock->timeStamp[samp];
-				timestamp = timestamp;
-				eventCode = dataBlock->ttlIn[samp];
+            timestamp = dataBlock->timeStamp[samp];
+            timestamp = timestamp;
+            eventCode = dataBlock->ttlIn[samp];
 
-				dataBuffer->addToBuffer(thisSample, &timestamp, &eventCode, 1);
-				 
-            }
+            dataBuffer->addToBuffer(thisSample, &timestamp, &eventCode, 1);
 
         }
-    
+
+    }
+
 
     if (dacOutputShouldChange)
     {
@@ -972,15 +978,19 @@ bool RHD2000Thread::updateBuffer()
         {
             evalBoard->enableDac(0, true);
             evalBoard->selectDacDataChannel(0, audioOutputR);
-        } else {
+        }
+        else
+        {
             evalBoard->enableDac(0, false);
         }
-            
+
         if (audioOutputL >= 0)
         {
             evalBoard->enableDac(1, true);
             evalBoard->selectDacDataChannel(1, audioOutputR);
-        } else {
+        }
+        else
+        {
             evalBoard->enableDac(1, false);
         }
 
diff --git a/Source/Processors/DataThreads/RHD2000Thread.h b/Source/Processors/DataThreads/RHD2000Thread.h
index 47faa406f3c77257451d7080818bf473bade459b..144e254d59330f601073327e8f1596192d9b217e 100644
--- a/Source/Processors/DataThreads/RHD2000Thread.h
+++ b/Source/Processors/DataThreads/RHD2000Thread.h
@@ -98,7 +98,7 @@ private:
     bool deviceFound;
 
     float thisSample[256];
-	float auxBuffer[256]; // aux inputs are only sampled every 4th sample, so use this to buffer the samples so they can be handles just like the regular neural channels later
+    float auxBuffer[256]; // aux inputs are only sampled every 4th sample, so use this to buffer the samples so they can be handles just like the regular neural channels later
 
     int blockSize;
 
@@ -123,7 +123,7 @@ private:
     void initializeBoard();
 
     void updateRegisters();
-    
+
     int deviceId(Rhd2000DataBlock* dataBlock, int stream);
 
     bool updateBuffer();
diff --git a/Source/Processors/Editors/ChannelMappingEditor.cpp b/Source/Processors/Editors/ChannelMappingEditor.cpp
index 4f7faf24396ee598c6d1427456c8e56e1c8f1e5d..d93aff3d0471fed5c87511e607b6f0c8d13e82ad 100644
--- a/Source/Processors/Editors/ChannelMappingEditor.cpp
+++ b/Source/Processors/Editors/ChannelMappingEditor.cpp
@@ -60,7 +60,7 @@ void ChannelMappingEditor::updateSettings()
 
     if (getProcessor()->getNumInputs() != previousChannelCount)
     {
-        
+
         createElectrodeButtons(getProcessor()->getNumInputs());
 
         previousChannelCount = getProcessor()->getNumInputs();
@@ -72,10 +72,10 @@ void ChannelMappingEditor::updateSettings()
 void ChannelMappingEditor::createElectrodeButtons(int numNeeded)
 {
 
-	electrodeButtons.clear();
+    electrodeButtons.clear();
 
-	referenceArray.clear();
-	channelArray.clear();
+    referenceArray.clear();
+    channelArray.clear();
 
     int width = 20;
     int height = 15;
@@ -83,7 +83,7 @@ void ChannelMappingEditor::createElectrodeButtons(int numNeeded)
     int row = 0;
     int column = 0;
 
-	for (int i = 0; i < numNeeded; i++)
+    for (int i = 0; i < numNeeded; i++)
     {
         ElectrodeButton* button = new ElectrodeButton(i+1);
         electrodeButtons.add(button);
@@ -118,53 +118,53 @@ void ChannelMappingEditor::createElectrodeButtons(int numNeeded)
 void ChannelMappingEditor::buttonEvent(Button* button)
 {
 
-	if (button == mappingButton) // mapping
-	{
+    if (button == mappingButton) // mapping
+    {
         std::cout << "Mapping button clicked." << std::endl;
 
-		referenceButton->setToggleState(false, false);
+        referenceButton->setToggleState(false, false);
         mappingButton->setToggleState(true, false);
 
-		for (int i = 0; i < electrodeButtons.size(); i++)
-		{
-			electrodeButtons[i]->setRadioGroupId(999);
-			electrodeButtons[i]->setChannelNum(channelArray[i]);
-			electrodeButtons[i]->repaint();
-		}
+        for (int i = 0; i < electrodeButtons.size(); i++)
+        {
+            electrodeButtons[i]->setRadioGroupId(999);
+            electrodeButtons[i]->setChannelNum(channelArray[i]);
+            electrodeButtons[i]->repaint();
+        }
 
-	}
-	 else if (button == referenceButton) // reference
-	{
+    }
+    else if (button == referenceButton) // reference
+    {
 
         std::cout << "Reference button clicked." << std::endl;
 
-		mappingButton->setToggleState(false, false);
+        mappingButton->setToggleState(false, false);
         referenceButton->setToggleState(true, false);
 
-		for (int i = 0; i < electrodeButtons.size(); i++)
-		{
-			electrodeButtons[i]->setRadioGroupId(0);
-			electrodeButtons[i]->setChannelNum(referenceArray[i]);
-			electrodeButtons[i]->repaint();
-		}
+        for (int i = 0; i < electrodeButtons.size(); i++)
+        {
+            electrodeButtons[i]->setRadioGroupId(0);
+            electrodeButtons[i]->setChannelNum(referenceArray[i]);
+            electrodeButtons[i]->repaint();
+        }
 
 
-	} 
-	else if (electrodeButtons.contains((ElectrodeButton*) button))
-	{
+    }
+    else if (electrodeButtons.contains((ElectrodeButton*) button))
+    {
 
-		ElectrodeButton* eb = (ElectrodeButton*) button;
+        ElectrodeButton* eb = (ElectrodeButton*) button;
         int electrodeNum = eb->getChannelNum()-1;
 
         std::cout << "Channel number: " << electrodeNum << std::endl;
         Array<int> a;
 
         if (electrodeNum >= 0)
-        	a.add(electrodeNum);
+            a.add(electrodeNum);
 
         channelSelector->setActiveChannels(a);
 
-	}
+    }
 
     std::cout << "Reference button state: " << referenceButton->getToggleState() << std::endl;
     std::cout << "Mapping button state: " << mappingButton->getToggleState() << std::endl;
@@ -173,7 +173,7 @@ void ChannelMappingEditor::buttonEvent(Button* button)
 
 void ChannelMappingEditor::channelChanged(int chan)
 {
-	for (int i = 0; i < electrodeButtons.size(); i++)
+    for (int i = 0; i < electrodeButtons.size(); i++)
     {
         if (electrodeButtons[i]->getToggleState())
         {
@@ -184,14 +184,16 @@ void ChannelMappingEditor::channelChanged(int chan)
 
             if (referenceButton->getToggleState()) // reference
             {
-            	referenceArray.set(i,chan);
+                referenceArray.set(i,chan);
 
-        		getProcessor()->setParameter(1,chan-1); // set reference
+                getProcessor()->setParameter(1,chan-1); // set reference
 
-            } else {
-            	channelArray.set(i,chan);
+            }
+            else
+            {
+                channelArray.set(i,chan);
 
-            	getProcessor()->setParameter(0,chan-1); // set mapping
+                getProcessor()->setParameter(0,chan-1); // set mapping
             }
 
         }
@@ -203,24 +205,24 @@ void ChannelMappingEditor::saveEditorParameters(XmlElement* xml)
 
     xml->setAttribute("Type", "ChannelMappingEditor");
 
-  //  XmlElement* selectedChannel = xml->createNewChildElement("SELECTEDID");
+    //  XmlElement* selectedChannel = xml->createNewChildElement("SELECTEDID");
 
-   // selectedChannel->setAttribute("ID",referenceSelector->getSelectedId());
+    // selectedChannel->setAttribute("ID",referenceSelector->getSelectedId());
 
 }
 
 void ChannelMappingEditor::loadEditorParameters(XmlElement* xml)
 {
 
-     forEachXmlChildElement(*xml, xmlNode)
-     {
+    forEachXmlChildElement(*xml, xmlNode)
+    {
         // if (xmlNode->hasTagName("SELECTEDID"))
-      //   {
-//
-           // int id = xmlNode->getIntAttribute("ID");
+        //   {
+        //
+        // int id = xmlNode->getIntAttribute("ID");
 
-          //  referenceSelector->setSelectedId(id);
+        //  referenceSelector->setSelectedId(id);
 
-      //  }
+        //  }
     }
 }
\ No newline at end of file
diff --git a/Source/Processors/Editors/ChannelMappingEditor.h b/Source/Processors/Editors/ChannelMappingEditor.h
index 46b7a499d8f9e453cccf8f63cafbab403e3c538a..bd9851fe335c8239d03da4365cc5929c9ab2b661 100644
--- a/Source/Processors/Editors/ChannelMappingEditor.h
+++ b/Source/Processors/Editors/ChannelMappingEditor.h
@@ -59,12 +59,12 @@ public:
 
 private:
 
- 	OwnedArray<ElectrodeButton> electrodeButtons;
- 	ScopedPointer<ElectrodeEditorButton> referenceButton;
- 	ScopedPointer<ElectrodeEditorButton> mappingButton;
+    OwnedArray<ElectrodeButton> electrodeButtons;
+    ScopedPointer<ElectrodeEditorButton> referenceButton;
+    ScopedPointer<ElectrodeEditorButton> mappingButton;
 
- 	Array<int> channelArray;
- 	Array<int> referenceArray;
+    Array<int> channelArray;
+    Array<int> referenceArray;
 
     int previousChannelCount;
 
diff --git a/Source/Processors/Editors/ChannelSelector.cpp b/Source/Processors/Editors/ChannelSelector.cpp
index 6e3b4bb3e3514414cdba77b1a0410d9b53b5f6e2..a627e4335115bdc9b3843a1f9076bdf33325b168 100755
--- a/Source/Processors/Editors/ChannelSelector.cpp
+++ b/Source/Processors/Editors/ChannelSelector.cpp
@@ -373,7 +373,7 @@ void ChannelSelector::setRadioStatus(bool radioOn)
 
     }
 
-  
+
 
 }
 
@@ -534,11 +534,11 @@ void ChannelSelector::buttonClicked(Button* button)
         }
 
         if (radioStatus) // if radio buttons are active
-            {
-                // send a message to parent
-                GenericEditor* editor = (GenericEditor*) getParentComponent();
-                editor->channelChanged(-1);
-            }
+        {
+            // send a message to parent
+            GenericEditor* editor = (GenericEditor*) getParentComponent();
+            editor->channelChanged(-1);
+        }
     }
     else
     {
@@ -836,5 +836,5 @@ void ChannelSelectorRegion::mouseWheelMove(const MouseEvent& event,
 
 void ChannelSelectorRegion::paint(Graphics& g)
 {
-   // g.fillAll(Colours::white);
+    // g.fillAll(Colours::white);
 }
\ No newline at end of file
diff --git a/Source/Processors/Editors/ChannelSelector.h b/Source/Processors/Editors/ChannelSelector.h
index dd8d45c55bf12cf528424ab08b30e2b76d7e1e7a..466fc6196af113e8172f491a56ae7dc64eaa7c8b 100755
--- a/Source/Processors/Editors/ChannelSelector.h
+++ b/Source/Processors/Editors/ChannelSelector.h
@@ -74,7 +74,10 @@ public:
     void setNumChannels(int);
 
     /** get the total number of channels. */
-    int getNumChannels(){return parameterButtons.size();}
+    int getNumChannels()
+    {
+        return parameterButtons.size();
+    }
 
     /** Return whether a particular channel should be recording. */
     bool getRecordStatus(int chan);
@@ -110,8 +113,11 @@ public:
     void activateButtons();
 
     /** Refreshes Parameter Colors on change*/
-    void refreshParameterColors(){GenericEditor* p=dynamic_cast<GenericEditor*>(getParentComponent());
-        p->updateParameterButtons(-1);}
+    void refreshParameterColors()
+    {
+        GenericEditor* p=dynamic_cast<GenericEditor*>(getParentComponent());
+        p->updateParameterButtons(-1);
+    }
 
     /** Controls the behavior of ChannelSelectorButtons; they can either behave
     like radio buttons (only one selected at a time) or like toggle buttons (an
@@ -255,7 +261,7 @@ public:
     ~ChannelSelectorRegion();
 
     /** Allows the user to scroll the channels if they are not all visible.*/
-    void mouseWheelMove(const MouseEvent& event, const MouseWheelDetails &wheel);
+    void mouseWheelMove(const MouseEvent& event, const MouseWheelDetails& wheel);
     void paint(Graphics& g);
 
 private:
diff --git a/Source/Processors/Editors/FileReaderEditor.cpp b/Source/Processors/Editors/FileReaderEditor.cpp
index 64a855c3539027f3e10af4f48cfbc77de424a38c..b77a609c20187c50cfd0ac50de598b2971fb3c46 100644
--- a/Source/Processors/Editors/FileReaderEditor.cpp
+++ b/Source/Processors/Editors/FileReaderEditor.cpp
@@ -28,22 +28,22 @@
 #include <stdio.h>
 
 FileReaderEditor::FileReaderEditor(GenericProcessor* parentNode, bool useDefaultParameterEditors=true)
-   : GenericEditor(parentNode, useDefaultParameterEditors)
+    : GenericEditor(parentNode, useDefaultParameterEditors)
 
 {
 
-	fileReader = (FileReader*) parentNode;
+    fileReader = (FileReader*) parentNode;
 
-	lastFilePath = File::getCurrentWorkingDirectory();
+    lastFilePath = File::getCurrentWorkingDirectory();
 
-	fileButton = new UtilityButton("Select file",Font("Small Text", 13, Font::plain));
-	fileButton->addListener(this);
-	fileButton->setBounds(30,50,120,25);
-	addAndMakeVisible(fileButton);
+    fileButton = new UtilityButton("Select file",Font("Small Text", 13, Font::plain));
+    fileButton->addListener(this);
+    fileButton->setBounds(30,50,120,25);
+    addAndMakeVisible(fileButton);
 
- 	fileNameLabel = new Label("FileNameLabel", "No file selected.");
-	fileNameLabel->setBounds(20,80,140,25);
-	addAndMakeVisible(fileNameLabel);
+    fileNameLabel = new Label("FileNameLabel", "No file selected.");
+    fileNameLabel->setBounds(20,80,140,25);
+    addAndMakeVisible(fileNameLabel);
 
     desiredWidth = 180;
 
@@ -59,65 +59,65 @@ FileReaderEditor::~FileReaderEditor()
 void FileReaderEditor::setFile(String file)
 {
 
-	File fileToRead(file);
-	lastFilePath = fileToRead.getParentDirectory();
-	fileReader->setFile(fileToRead.getFullPathName());
-	fileNameLabel->setText(fileToRead.getFileName(),false);
+    File fileToRead(file);
+    lastFilePath = fileToRead.getParentDirectory();
+    fileReader->setFile(fileToRead.getFullPathName());
+    fileNameLabel->setText(fileToRead.getFileName(),false);
 
-	setEnabledState(true);
+    setEnabledState(true);
 
-	repaint();
+    repaint();
 }
 
 void FileReaderEditor::buttonEvent(Button* button)
 {
 
-	if (!acquisitionIsActive)
-	{
+    if (!acquisitionIsActive)
+    {
 
-		if (button == fileButton)
-		{
-			//std::cout << "Button clicked." << std::endl;
-			FileChooser chooseFileReaderFile("Please select the file you want to load...",
-                                          lastFilePath,
-                                          "*");
+        if (button == fileButton)
+        {
+            //std::cout << "Button clicked." << std::endl;
+            FileChooser chooseFileReaderFile("Please select the file you want to load...",
+                                             lastFilePath,
+                                             "*");
 
-	         if (chooseFileReaderFile.browseForFileToOpen())
-	         {
-	             // Use the selected file
-	             setFile(chooseFileReaderFile.getResult().getFullPathName());
+            if (chooseFileReaderFile.browseForFileToOpen())
+            {
+                // Use the selected file
+                setFile(chooseFileReaderFile.getResult().getFullPathName());
 
-	             // lastFilePath = fileToRead.getParentDirectory();
+                // lastFilePath = fileToRead.getParentDirectory();
 
-	             // thread->setFile(fileToRead.getFullPathName());
+                // thread->setFile(fileToRead.getFullPathName());
 
-	             // fileNameLabel->setText(fileToRead.getFileName(),false);
-			}
-		}
+                // fileNameLabel->setText(fileToRead.getFileName(),false);
+            }
+        }
 
-	}
+    }
 }
 
 void FileReaderEditor::saveEditorParameters(XmlElement* xml)
 {
 
-	// XmlElement* fileName = xml->createNewChildElement("FILENAME");
-	// fileName->addTextElement(lastFilePath.getFullPathName());
+    // XmlElement* fileName = xml->createNewChildElement("FILENAME");
+    // fileName->addTextElement(lastFilePath.getFullPathName());
 
 }
 
 void FileReaderEditor::loadEditorParameters(XmlElement* xml)
 {
 
-	 // forEachXmlChildElement(*xml, xmlNode)
-  //    {
-  //       if (xmlNode->hasTagName("FILENAME"))
-  //       {
-            
-  //           lastFilePath = File(xmlNode->getText());
-  //           thread->setFile(lastFilePath.getFullPathName());
-  //           fileNameLabel->setText(lastFilePath.getFullPathName(),false);
-  //       }
-  //   }
+    // forEachXmlChildElement(*xml, xmlNode)
+    //    {
+    //       if (xmlNode->hasTagName("FILENAME"))
+    //       {
+
+    //           lastFilePath = File(xmlNode->getText());
+    //           thread->setFile(lastFilePath.getFullPathName());
+    //           fileNameLabel->setText(lastFilePath.getFullPathName(),false);
+    //       }
+    //   }
 
 }
\ No newline at end of file
diff --git a/Source/Processors/Editors/FileReaderEditor.h b/Source/Processors/Editors/FileReaderEditor.h
index fb82c4b6acd9274a3a2ef679a01555a13487c127..1e789d5ffa5ccc09473a39dc17dd30b5be086bc6 100644
--- a/Source/Processors/Editors/FileReaderEditor.h
+++ b/Source/Processors/Editors/FileReaderEditor.h
@@ -39,7 +39,7 @@ class FileReader;
 
 */
 
-  class FileReaderEditor : public GenericEditor
+class FileReaderEditor : public GenericEditor
 
 {
 public:
@@ -51,17 +51,17 @@ public:
     void setFile(String file);
 
     void saveEditorParameters(XmlElement*);
-    
+
     void loadEditorParameters(XmlElement*);
 
 private:
 
-	ScopedPointer<UtilityButton> fileButton;
-	ScopedPointer<Label> fileNameLabel;
+    ScopedPointer<UtilityButton> fileButton;
+    ScopedPointer<Label> fileNameLabel;
 
-	FileReader* fileReader;
+    FileReader* fileReader;
 
-	File lastFilePath;
+    File lastFilePath;
 
     JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FileReaderEditor);
 
diff --git a/Source/Processors/Editors/FilterEditor.cpp b/Source/Processors/Editors/FilterEditor.cpp
index fd7ee0808cc44e444f8ba308edddf368c2857dc5..46d828348c6b010cacbbdae976f671b6aa6ab506 100755
--- a/Source/Processors/Editors/FilterEditor.cpp
+++ b/Source/Processors/Editors/FilterEditor.cpp
@@ -65,36 +65,13 @@ FilterEditor::FilterEditor(GenericProcessor* parentNode, bool useDefaultParamete
     highCutValue->addListener(this);
     addAndMakeVisible(highCutValue);
 
-    //createRadioButtons(35, 50, 160, lowCutValues, "Low Cutoff");
-    //createRadioButtons(35, 90, 160, highCutValues, "High Cutoff");
-
-    // for (int n = 0; n < getNumChildComponents(); n++)
-    // {
-    // 	Button* c = (Button*) getChildComponent(n);
-
-    // 	if (c->isVisible())
-    // 		c->addListener(this);
-
-    // 	if (c->getRadioGroupId() != 999)
-    // 		c->setVisible(true);
-    // }
-
 }
 
 FilterEditor::~FilterEditor()
 {
-   // deleteAllChildren();
+ 
 }
 
-// void FilterEditor::sliderValueChanged (Slider* slider)
-// {
-
-// 	if (slider == lowSlider)
-// 		getAudioProcessor()->setParameter(0,slider->getValue());
-// 	else
-// 		getAudioProcessor()->setParameter(1,slider->getValue());
-
-// }
 
 void FilterEditor::labelTextChanged(Label* label)
 {
@@ -110,7 +87,9 @@ void FilterEditor::labelTextChanged(Label* label)
         if (label == highCutValue)
         {
             label->setText(lastHighCutString, dontSendNotification);
-        } else {
+        }
+        else
+        {
             label->setText(lastLowCutString, dontSendNotification);
         }
 
@@ -133,11 +112,13 @@ void FilterEditor::labelTextChanged(Label* label)
             {
                 fn->setCurrentChannel(n);
                 fn->setParameter(1, requestedValue);
-            } 
+            }
 
             lastHighCutString = label->getText();
 
-        } else {
+        }
+        else
+        {
             double maxVal = fn->getHighCutValueForChannel(n);
 
             if (requestedValue < maxVal)
@@ -198,12 +179,12 @@ void FilterEditor::saveEditorParameters(XmlElement* xml)
 void FilterEditor::loadEditorParameters(XmlElement* xml)
 {
 
-     forEachXmlChildElement(*xml, xmlNode)
-     {
-         if (xmlNode->hasTagName("VALUES"))
-         {
+    forEachXmlChildElement(*xml, xmlNode)
+    {
+        if (xmlNode->hasTagName("VALUES"))
+        {
             highCutValue->setText(xmlNode->getStringAttribute("HighCut"),dontSendNotification);
             lowCutValue->setText(xmlNode->getStringAttribute("LowCut"),dontSendNotification);
-         }   
-     }
+        }
+    }
 }
diff --git a/Source/Processors/Editors/FilterEditor.h b/Source/Processors/Editors/FilterEditor.h
index 4925e92b2cb0065bef5a808ef44d1105cfa9302d..0e727a09086536697f16f5d43ae301b15d909ae6 100755
--- a/Source/Processors/Editors/FilterEditor.h
+++ b/Source/Processors/Editors/FilterEditor.h
@@ -38,8 +38,8 @@ class FilterViewport;
 
 */
 
-class FilterEditor : public GenericEditor, 
-                     public Label::Listener
+class FilterEditor : public GenericEditor,
+    public Label::Listener
 {
 public:
     FilterEditor(GenericProcessor* parentNode, bool useDefaultParameterEditors);
diff --git a/Source/Processors/Editors/GenericEditor.cpp b/Source/Processors/Editors/GenericEditor.cpp
index 6c41a3a48733dca79f49c9c72b521e4af3e6758f..428473577e9a50df9e371e4365a70bc2f7205f95 100755
--- a/Source/Processors/Editors/GenericEditor.cpp
+++ b/Source/Processors/Editors/GenericEditor.cpp
@@ -36,7 +36,7 @@
 GenericEditor::GenericEditor(GenericProcessor* owner, bool useDefaultParameterEditors=true)
     : AudioProcessorEditor(owner),
       desiredWidth(150), isFading(false), accumulator(0.0), acquisitionIsActive(false),
-      drawerButton(0), channelSelector(0), 
+      drawerButton(0), channelSelector(0),
       isSelected(false),  isEnabled(true), tNum(-1)
 {
     constructorInitialize(owner, useDefaultParameterEditors);
@@ -92,7 +92,8 @@ void GenericEditor::constructorInitialize(GenericProcessor* owner, bool useDefau
 
         isSplitOrMerge=false;
     }
-    else{
+    else
+    {
         isSplitOrMerge=true;
     }
 
@@ -464,10 +465,11 @@ Array<int> GenericEditor::getActiveChannels()
 {
     if (!isSplitOrMerge)
     {
-    Array<int> a = channelSelector->getActiveChannels();
-    return a;
+        Array<int> a = channelSelector->getActiveChannels();
+        return a;
     }
-    else{
+    else
+    {
         Array<int> a;
         return a;
     }
@@ -477,9 +479,10 @@ bool GenericEditor::getRecordStatus(int chan)
 {
     if (!isSplitOrMerge)
     {
-    return channelSelector->getRecordStatus(chan);
+        return channelSelector->getRecordStatus(chan);
     }
-    else{
+    else
+    {
         return false;
     }
 }
@@ -490,7 +493,8 @@ bool GenericEditor::getAudioStatus(int chan)
     {
         return channelSelector->getAudioStatus(chan);
     }
-    else{
+    else
+    {
         return false;
     }
 }
@@ -503,7 +507,8 @@ void GenericEditor::getChannelSelectionState(int chan, bool* p, bool* r, bool* a
         *r = channelSelector->getRecordStatus(chan);
         *a = channelSelector->getAudioStatus(chan);
     }
-    else{
+    else
+    {
         *p = false;
         *r = false;
         *a = false;
@@ -827,6 +832,6 @@ void GenericEditor::updateParameterButtons(int parameterIndex)
         {
             parameterEditors[parameterIndex]->channelSelectionUI();
         }
-    //std::cout << "updateParameterButtons" << std::endl;
+        //std::cout << "updateParameterButtons" << std::endl;
     }
 }
diff --git a/Source/Processors/Editors/ParameterEditor.cpp b/Source/Processors/Editors/ParameterEditor.cpp
index b81d70cbc8fec835eac3f05212247f0d3fbb61d8..d818c82c39a56afd73ced33b26edad45f4639252 100755
--- a/Source/Processors/Editors/ParameterEditor.cpp
+++ b/Source/Processors/Editors/ParameterEditor.cpp
@@ -268,11 +268,11 @@ ParameterButton::ParameterButton(var value, int buttonType, Font labelFont) :
                                       Colour(190,150,25),0.0, 0.0f,
                                       false);
     usedByNonActiveGrad = ColourGradient(Colour(200,100,0),0.0,0.0,
-                                  Colour(158,95,32),0.0, 20.0f,
-                                  false);
+                                         Colour(158,95,32),0.0, 20.0f,
+                                         false);
     usedByNonActiveOverGrad = ColourGradient(Colour(158,95,32),0.0, 5.0f,
-                                      Colour(128,70,13),0.0, 0.0f,
-                                      false);
+                                             Colour(128,70,13),0.0, 0.0f,
+                                             false);
     neutralGrad = ColourGradient(Colour(220,220,220),0.0,0.0,
                                  Colour(170,170,170),0.0, 20.0f,
                                  false);
@@ -526,13 +526,13 @@ void ParameterEditor::channelSelectionUI()
         for (int i = 0; i < buttonArray.size(); i++)
         {
             buttonArray[i]->colorState=0;
-            
+
             for (int j = 0; j < numChannels; j++)
             {
 
                 if (possibleValues[i]==parameter->getValue(j))
                 {
-                    
+
                     if (channelSelector->getParamStatus(j))
                     {
                         /* Set button as usedbyactive */
@@ -543,9 +543,9 @@ void ParameterEditor::channelSelectionUI()
                     {
                         // Set button as used by non-selected
                         buttonArray[i]->colorState=2;
-                    }   
+                    }
 
-                } 
+                }
             }
             buttonArray[i]->repaint();
 
diff --git a/Source/Processors/Editors/PhaseDetectorEditor.cpp b/Source/Processors/Editors/PhaseDetectorEditor.cpp
index 47e0e4582e143d17892b0f431c5700f96f1fdb47..f24e1ac7e5fbaa90f23818221a9f150ac43a4b8c 100644
--- a/Source/Processors/Editors/PhaseDetectorEditor.cpp
+++ b/Source/Processors/Editors/PhaseDetectorEditor.cpp
@@ -79,8 +79,10 @@ void PhaseDetectorEditor::comboBoxChanged(ComboBox* c)
 
     if (id == 1)
     {
-        channel = -1.0f; 
-    } else {
+        channel = -1.0f;
+    }
+    else
+    {
         channel = float(id) - 2.0f;
     }
 
@@ -108,10 +110,10 @@ void PhaseDetectorEditor::saveEditorParameters(XmlElement* xml)
 void PhaseDetectorEditor::loadEditorParameters(XmlElement* xml)
 {
 
-     forEachXmlChildElement(*xml, xmlNode)
-     {
-         if (xmlNode->hasTagName("SELECTEDID"))
-         {
+    forEachXmlChildElement(*xml, xmlNode)
+    {
+        if (xmlNode->hasTagName("SELECTEDID"))
+        {
 
             int id = xmlNode->getIntAttribute("ID");
 
diff --git a/Source/Processors/Editors/PhaseDetectorEditor.h b/Source/Processors/Editors/PhaseDetectorEditor.h
index fff420cea81cff54087e46a2bba44d49ba3b2a95..eb6311bc2f50171755dd6f37bc409db5ef1358c6 100644
--- a/Source/Processors/Editors/PhaseDetectorEditor.h
+++ b/Source/Processors/Editors/PhaseDetectorEditor.h
@@ -37,7 +37,7 @@
 */
 
 class PhaseDetectorEditor : public GenericEditor,
-                            public ComboBox::Listener
+    public ComboBox::Listener
 {
 public:
     PhaseDetectorEditor(GenericProcessor* parentNode, bool useDefaultParameterEditors);
diff --git a/Source/Processors/Editors/PulsePalOutputEditor.cpp b/Source/Processors/Editors/PulsePalOutputEditor.cpp
index d11b54512d2e0125807414cfac2ae35be413608d..c0cfa5a4deb1f8d7c26dbf817132370db7789067 100644
--- a/Source/Processors/Editors/PulsePalOutputEditor.cpp
+++ b/Source/Processors/Editors/PulsePalOutputEditor.cpp
@@ -120,16 +120,17 @@ void ChannelTriggerInterface::buttonClicked(Button* button)
 void ChannelTriggerInterface::comboBoxChanged(ComboBox* comboBoxThatHasChanged)
 {
     //std::cout << "Combo box changed to " << comboBoxThatHasChanged->getSelectedId() << std::endl;
-   
+
     if (comboBoxThatHasChanged == triggerSelector)
     {
         processor->setParameter(0, channelNumber);
         processor->setParameter(1, (float) comboBoxThatHasChanged->getSelectedId() - 2);
-    } else if (comboBoxThatHasChanged == gateSelector)
+    }
+    else if (comboBoxThatHasChanged == gateSelector)
     {
         processor->setParameter(0, channelNumber);
         processor->setParameter(2, (float) comboBoxThatHasChanged->getSelectedId() - 2);
     }
 
-    
+
 }
diff --git a/Source/Processors/Editors/RHD2000Editor.cpp b/Source/Processors/Editors/RHD2000Editor.cpp
index 65a84dc7a54c6db3c54d9687b761edc4502ecc57..fa6ce9ac0e25dacf3bf43fbaa1edd0840d4800e0 100644
--- a/Source/Processors/Editors/RHD2000Editor.cpp
+++ b/Source/Processors/Editors/RHD2000Editor.cpp
@@ -88,7 +88,7 @@ RHD2000Editor::RHD2000Editor(GenericProcessor* parentNode,
     adcButton->addListener(this);
     adcButton->setClickingTogglesState(true);
     addAndMakeVisible(adcButton);
-    
+
 
 }
 
@@ -114,13 +114,16 @@ void RHD2000Editor::buttonEvent(Button* button)
             headstageOptionsInterfaces[i]->checkEnabledState();
         }
 
-    } else if (button == electrodeButtons[0])
+    }
+    else if (button == electrodeButtons[0])
     {
-        channelSelector->setRadioStatus(true);   
-    } else if (button == electrodeButtons[1])
+        channelSelector->setRadioStatus(true);
+    }
+    else if (button == electrodeButtons[1])
     {
-        channelSelector->setRadioStatus(true);   
-    } else if (button == adcButton)
+        channelSelector->setRadioStatus(true);
+    }
+    else if (button == adcButton)
     {
         board->enableAdcs(button->getToggleState());
         getEditorViewport()->makeEditorVisible(this, false, true);
@@ -166,10 +169,33 @@ void RHD2000Editor::stopAcquisition()
 
 }
 
+void RHD2000Editor::saveEditorParameters(XmlElement* xml)
+{
+     xml->setAttribute("SampleRate", sampleRateInterface->getSelectedId());
+     xml->setAttribute("LowCut", bandwidthInterface->getLowerBandwidth());
+     xml->setAttribute("HighCut", bandwidthInterface->getUpperBandwidth());
+     xml->setAttribute("ADCsOn", adcButton->getToggleState());
+
+    //  XmlElement* selectedChannel = xml->createNewChildElement("SELECTEDID");
+
+    // selectedChannel->setAttribute("ID",referenceSelector->getSelectedId());
+}
+
+void RHD2000Editor::loadEditorParameters(XmlElement* xml)
+{
+    
+    sampleRateInterface->setSelectedId(xml->getIntAttribute("SampleRate"));
+    bandwidthInterface->setLowerBandwidth(xml->getDoubleAttribute("LowCut"));
+    bandwidthInterface->setUpperBandwidth(xml->getDoubleAttribute("HighCut"));
+    adcButton->setToggleState(xml->getBoolAttribute("ADCsOn"), true);
+
+}
+
+
 // Bandwidth Options --------------------------------------------------------------------
 
 BandwidthInterface::BandwidthInterface(RHD2000Thread* board_,
-                                                     RHD2000Editor* editor_) :
+                                       RHD2000Editor* editor_) :
     board(board_), editor(editor_)
 {
 
@@ -178,21 +204,24 @@ BandwidthInterface::BandwidthInterface(RHD2000Thread* board_,
     lastHighCutString = "7500";
     lastLowCutString = "1";
 
-    UpperBandwidthSelection = new Label("UpperBandwidth",lastHighCutString); // this is currently set in RHD2000Thread, the cleaner would be to set it here again
-    UpperBandwidthSelection->setEditable(true,false,false);
-    UpperBandwidthSelection->addListener(this);
-    UpperBandwidthSelection->setBounds(30,30,60,20);
-    UpperBandwidthSelection->setColour(Label::textColourId, Colours::darkgrey);
-    addAndMakeVisible(UpperBandwidthSelection);
+    actualUpperBandwidth = 7500.0f;
+    actualLowerBandwidth = 1.0f;
+
+    upperBandwidthSelection = new Label("UpperBandwidth",lastHighCutString); // this is currently set in RHD2000Thread, the cleaner would be to set it here again
+    upperBandwidthSelection->setEditable(true,false,false);
+    upperBandwidthSelection->addListener(this);
+    upperBandwidthSelection->setBounds(30,30,60,20);
+    upperBandwidthSelection->setColour(Label::textColourId, Colours::darkgrey);
+    addAndMakeVisible(upperBandwidthSelection);
 
 
-    LowerBandwidthSelection = new Label("LowerBandwidth",lastLowCutString);
-    LowerBandwidthSelection->setEditable(true,false,false);
-    LowerBandwidthSelection->addListener(this);
-    LowerBandwidthSelection->setBounds(25,10,60,20);
-    LowerBandwidthSelection->setColour(Label::textColourId, Colours::darkgrey);
+    lowerBandwidthSelection = new Label("LowerBandwidth",lastLowCutString);
+    lowerBandwidthSelection->setEditable(true,false,false);
+    lowerBandwidthSelection->addListener(this);
+    lowerBandwidthSelection->setBounds(25,10,60,20);
+    lowerBandwidthSelection->setColour(Label::textColourId, Colours::darkgrey);
 
-    addAndMakeVisible(LowerBandwidthSelection);
+    addAndMakeVisible(lowerBandwidthSelection);
 
 
 
@@ -206,10 +235,10 @@ BandwidthInterface::~BandwidthInterface()
 
 void BandwidthInterface::labelTextChanged(Label* label)
 {
-    
+
     if (!(editor->acquisitionIsActive) && board->foundInputSource())
     {
-        if (label == UpperBandwidthSelection)
+        if (label == upperBandwidthSelection)
         {
 
             Value val = label->getTextValue();
@@ -224,13 +253,15 @@ void BandwidthInterface::labelTextChanged(Label* label)
                 return;
             }
 
-            double actualUpperBandwidth = board->setUpperBandwidth(requestedValue);
+            actualUpperBandwidth = board->setUpperBandwidth(requestedValue);
 
             std::cout << "Setting Upper Bandwidth to " << requestedValue << std::endl;
             std::cout << "Actual Upper Bandwidth:  " <<  actualUpperBandwidth  << std::endl;
             label->setText(String((roundFloatToInt)(actualUpperBandwidth)), false);
 
-        } else {
+        }
+        else
+        {
 
             Value val = label->getTextValue();
             double requestedValue = double(val.getValue());
@@ -239,12 +270,12 @@ void BandwidthInterface::labelTextChanged(Label* label)
             {
                 editor->sendActionMessage("Value out of range.");
 
-                 label->setText(lastLowCutString, dontSendNotification);
+                label->setText(lastLowCutString, dontSendNotification);
 
                 return;
             }
 
-            double actualLowerBandwidth = board->setLowerBandwidth(requestedValue);
+            actualLowerBandwidth = board->setLowerBandwidth(requestedValue);
 
             std::cout << "Setting Upper Bandwidth to " << requestedValue << std::endl;
             std::cout << "Actual Upper Bandwidth:  " <<  actualLowerBandwidth  << std::endl;
@@ -253,13 +284,33 @@ void BandwidthInterface::labelTextChanged(Label* label)
     }
 }
 
+void BandwidthInterface::setLowerBandwidth(double value)
+{
+    actualLowerBandwidth = board->setLowerBandwidth(value);
+    lowerBandwidthSelection->setText(String(roundFloatToInt(actualLowerBandwidth)), false);
+}
 
+void BandwidthInterface::setUpperBandwidth(double value)
+{
+    actualUpperBandwidth = board->setUpperBandwidth(value);
+    upperBandwidthSelection->setText(String(roundFloatToInt(actualUpperBandwidth)), false);
+}
+
+double BandwidthInterface::getLowerBandwidth()
+{
+    return actualLowerBandwidth;
+}
+
+double BandwidthInterface::getUpperBandwidth()
+{
+    return actualUpperBandwidth;
+}
 
 
 void BandwidthInterface::paint(Graphics& g)
 {
 
-     g.setColour(Colours::darkgrey);
+    g.setColour(Colours::darkgrey);
 
     g.setFont(Font("Small Text",10,Font::plain));
 
@@ -274,11 +325,11 @@ void BandwidthInterface::paint(Graphics& g)
 // Sample rate Options --------------------------------------------------------------------
 
 SampleRateInterface::SampleRateInterface(RHD2000Thread* board_,
-                                                     RHD2000Editor* editor_) :
+                                         RHD2000Editor* editor_) :
     board(board_), editor(editor_)
 {
 
-    name="Sample Rate";
+    name = "Sample Rate";
 
     sampleRateOptions.add("1.00 kS/s");
     sampleRateOptions.add("1.25 kS/s");
@@ -317,7 +368,7 @@ SampleRateInterface::~SampleRateInterface()
 
 void SampleRateInterface::comboBoxChanged(ComboBox* cb)
 {
-	if (!(editor->acquisitionIsActive) && board->foundInputSource())
+    if (!(editor->acquisitionIsActive) && board->foundInputSource())
     {
         if (cb == rateSelection)
         {
@@ -330,13 +381,21 @@ void SampleRateInterface::comboBoxChanged(ComboBox* cb)
     }
 }
 
+int SampleRateInterface::getSelectedId()
+{
+    return rateSelection->getSelectedId();
+}
 
+void SampleRateInterface::setSelectedId(int id)
+{
+    rateSelection->setSelectedId(id);
+}
 
 
 void SampleRateInterface::paint(Graphics& g)
 {
 
-     g.setColour(Colours::darkgrey);
+    g.setColour(Colours::darkgrey);
 
     g.setFont(Font("Small Text",10,Font::plain));
 
@@ -377,7 +436,7 @@ HeadstageOptionsInterface::HeadstageOptionsInterface(RHD2000Thread* board_,
     channelsOnHs1 = 0;
     channelsOnHs2 = 0;
 
-    
+
 
     hsButton1 = new UtilityButton(" ", Font("Small Text", 13, Font::plain));
     hsButton1->setRadius(3.0f);
@@ -405,7 +464,7 @@ HeadstageOptionsInterface::~HeadstageOptionsInterface()
 
 void HeadstageOptionsInterface::checkEnabledState()
 {
-    isEnabled = (board->isHeadstageEnabled(hsNumber1) || 
+    isEnabled = (board->isHeadstageEnabled(hsNumber1) ||
                  board->isHeadstageEnabled(hsNumber2));
 
     if (board->isHeadstageEnabled(hsNumber1))
@@ -413,7 +472,9 @@ void HeadstageOptionsInterface::checkEnabledState()
         channelsOnHs1 = 32;
         hsButton1->setLabel(String(channelsOnHs1));
         hsButton1->setEnabledState(true);
-    } else {
+    }
+    else
+    {
         channelsOnHs1 = 0;
         hsButton1->setLabel(" ");
         hsButton1->setEnabledState(false);
@@ -424,7 +485,9 @@ void HeadstageOptionsInterface::checkEnabledState()
         channelsOnHs2 = 32;
         hsButton2->setLabel(String(channelsOnHs2));
         hsButton2->setEnabledState(true);
-    } else {
+    }
+    else
+    {
         channelsOnHs2 = 0;
         hsButton2->setLabel(" ");
         hsButton2->setEnabledState(false);
@@ -453,7 +516,8 @@ void HeadstageOptionsInterface::buttonClicked(Button* button)
             hsButton1->setLabel(String(channelsOnHs1));
             board->setNumChannels(hsNumber1, channelsOnHs1);
 
-        } else if (button == hsButton2)
+        }
+        else if (button == hsButton2)
         {
             if (channelsOnHs2 == 32)
                 channelsOnHs2 = 16;
diff --git a/Source/Processors/Editors/RHD2000Editor.h b/Source/Processors/Editors/RHD2000Editor.h
index 5ae7c7f3891a369aa392d28751572a1e31faaa28..45e032fe7cfd2e937fe864a259aa643de62c88ca 100644
--- a/Source/Processors/Editors/RHD2000Editor.h
+++ b/Source/Processors/Editors/RHD2000Editor.h
@@ -61,6 +61,9 @@ public:
 
     void channelChanged(int chan);
 
+    void saveEditorParameters(XmlElement* xml);
+    void loadEditorParameters(XmlElement* xml);
+
 private:
 
     OwnedArray<HeadstageOptionsInterface> headstageOptionsInterfaces;
@@ -121,6 +124,11 @@ public:
     void paint(Graphics& g);
     void labelTextChanged(Label* te);
 
+    void setLowerBandwidth(double value);
+    void setUpperBandwidth(double value);
+    double getLowerBandwidth();
+    double getUpperBandwidth();
+
 private:
 
     String name;
@@ -130,8 +138,11 @@ private:
     RHD2000Thread* board;
     RHD2000Editor* editor;
 
-    ScopedPointer<Label> UpperBandwidthSelection;
-    ScopedPointer<Label> LowerBandwidthSelection;
+    ScopedPointer<Label> upperBandwidthSelection;
+    ScopedPointer<Label> lowerBandwidthSelection;
+
+    double actualUpperBandwidth;
+    double actualLowerBandwidth;
 
 };
 
@@ -143,6 +154,9 @@ public:
     SampleRateInterface(RHD2000Thread*, RHD2000Editor*);
     ~SampleRateInterface();
 
+    int getSelectedId();
+    void setSelectedId(int);
+
     void paint(Graphics& g);
     void comboBoxChanged(ComboBox* cb);
 
diff --git a/Source/Processors/Editors/ReferenceNodeEditor.cpp b/Source/Processors/Editors/ReferenceNodeEditor.cpp
index 91bea3e29034429af15563ba4eb2aa758c8b3c8c..700f42647662b9349a101cd29dc343818b7b1ca6 100644
--- a/Source/Processors/Editors/ReferenceNodeEditor.cpp
+++ b/Source/Processors/Editors/ReferenceNodeEditor.cpp
@@ -79,8 +79,10 @@ void ReferenceNodeEditor::comboBoxChanged(ComboBox* c)
 
     if (id == 1)
     {
-        channel = -1.0f; 
-    } else {
+        channel = -1.0f;
+    }
+    else
+    {
         channel = float(id) - 2.0f;
     }
 
@@ -108,10 +110,10 @@ void ReferenceNodeEditor::saveEditorParameters(XmlElement* xml)
 void ReferenceNodeEditor::loadEditorParameters(XmlElement* xml)
 {
 
-     forEachXmlChildElement(*xml, xmlNode)
-     {
-         if (xmlNode->hasTagName("SELECTEDID"))
-         {
+    forEachXmlChildElement(*xml, xmlNode)
+    {
+        if (xmlNode->hasTagName("SELECTEDID"))
+        {
 
             int id = xmlNode->getIntAttribute("ID");
 
diff --git a/Source/Processors/Editors/ReferenceNodeEditor.h b/Source/Processors/Editors/ReferenceNodeEditor.h
index defe11c759414ba8a23eed210b5f63b2fa639ec4..7ae0f9a5de24865e06b096d5de429a1156a0ee43 100644
--- a/Source/Processors/Editors/ReferenceNodeEditor.h
+++ b/Source/Processors/Editors/ReferenceNodeEditor.h
@@ -36,7 +36,7 @@
 */
 
 class ReferenceNodeEditor : public GenericEditor,
-                            public ComboBox::Listener
+    public ComboBox::Listener
 {
 public:
     ReferenceNodeEditor(GenericProcessor* parentNode, bool useDefaultParameterEditors);
diff --git a/Source/Processors/Editors/ResamplingNodeEditor.h b/Source/Processors/Editors/ResamplingNodeEditor.h
index ee3fce9c7f280b7456dcd9934ae14dce92e58a23..9e347e62b696f8911113b45e0093233bb8bc1471 100644
--- a/Source/Processors/Editors/ResamplingNodeEditor.h
+++ b/Source/Processors/Editors/ResamplingNodeEditor.h
@@ -42,7 +42,7 @@ public:
     ResamplingNodeEditor(GenericProcessor* parentNode, bool useDefaultParameterEditors);
     virtual ~ResamplingNodeEditor();
 
-   // void startAcquisition();
+    // void startAcquisition();
     //void stopAcquisition();
 
 private:
diff --git a/Source/Processors/Editors/SpikeDetectorEditor.cpp b/Source/Processors/Editors/SpikeDetectorEditor.cpp
index 92ba610036d18777affc392b3acb701230568e03..5a8a063a3dce6cb147c0b33a44485e33861a7faa 100755
--- a/Source/Processors/Editors/SpikeDetectorEditor.cpp
+++ b/Source/Processors/Editors/SpikeDetectorEditor.cpp
@@ -194,7 +194,9 @@ void SpikeDetectorEditor::buttonEvent(Button* button)
             thresholdSlider->setActive(true);
             thresholdSlider->setValue(processor->getChannelThreshold(electrodeList->getSelectedItemIndex(),
                                                                      electrodeButtons.indexOf((ElectrodeButton*) button)));
-        } else {
+        }
+        else
+        {
 
             SpikeDetector* processor = (SpikeDetector*) getProcessor();
 
@@ -207,10 +209,10 @@ void SpikeDetectorEditor::buttonEvent(Button* button)
                                         button->getToggleState());
 
             std::cout << "Disabling channel " << channelNum <<
-                         " of electrode " << electrodeNum << std::endl;
+                      " of electrode " << electrodeNum << std::endl;
 
         }
-    
+
 
     }
 
@@ -264,7 +266,7 @@ void SpikeDetectorEditor::buttonEvent(Button* button)
             }
         }
 
-        
+
         getEditorViewport()->makeEditorVisible(this, true, true);
         return;
 
@@ -385,7 +387,9 @@ bool SpikeDetectorEditor::addElectrode(int nChans)
     {
         refreshElectrodeList();
         return true;
-    } else {
+    }
+    else
+    {
         return false;
     }
 
diff --git a/Source/Processors/Editors/SpikeDetectorEditor.h b/Source/Processors/Editors/SpikeDetectorEditor.h
index 2fae5e948af40923ac7d1ad435706afef1dd6930..2bbf5d90f55abb38a4e5d3b45b06f5f58b863d27 100755
--- a/Source/Processors/Editors/SpikeDetectorEditor.h
+++ b/Source/Processors/Editors/SpikeDetectorEditor.h
@@ -173,7 +173,7 @@ private:
     OwnedArray<ElectrodeButton> electrodeButtons;
     Array<ElectrodeEditorButton*> electrodeEditorButtons;
 
-    
+
     void removeElectrode(int index);
     void editElectrode(int index, int chan, int newChan);
 
diff --git a/Source/Processors/Editors/VisualizerEditor.cpp b/Source/Processors/Editors/VisualizerEditor.cpp
index ff432a7bfd4031996702babf17eb177bf18be598..73ffa333711792c6c7dee92e06bc473aa239c0f2 100755
--- a/Source/Processors/Editors/VisualizerEditor.cpp
+++ b/Source/Processors/Editors/VisualizerEditor.cpp
@@ -281,10 +281,10 @@ void VisualizerEditor::saveEditorParameters(XmlElement* xml)
 void VisualizerEditor::loadEditorParameters(XmlElement* xml)
 {
 
-     forEachXmlChildElement(*xml, xmlNode)
-     {
-         if (xmlNode->hasTagName("TAB"))
-         {
+    forEachXmlChildElement(*xml, xmlNode)
+    {
+        if (xmlNode->hasTagName("TAB"))
+        {
 
             bool tabState = xmlNode->getBoolAttribute("Active");
 
@@ -292,21 +292,23 @@ void VisualizerEditor::loadEditorParameters(XmlElement* xml)
                 tabSelector->setToggleState(true,true);
 
 
-         } else if (xmlNode->hasTagName("WINDOW")) {
+        }
+        else if (xmlNode->hasTagName("WINDOW"))
+        {
 
-             bool windowState = xmlNode->getBoolAttribute("Active");
+            bool windowState = xmlNode->getBoolAttribute("Active");
 
-             if (windowState)
+            if (windowState)
             {
                 windowSelector->setToggleState(true,true);
                 dataWindow->setBounds(xmlNode->getIntAttribute("x"),
-                                          xmlNode->getIntAttribute("y"),
-                                          xmlNode->getIntAttribute("width"),
-                                          xmlNode->getIntAttribute("height"));
+                                      xmlNode->getIntAttribute("y"),
+                                      xmlNode->getIntAttribute("width"),
+                                      xmlNode->getIntAttribute("height"));
 
             }
-            
-         }
+
+        }
     }
 
     if (canvas != nullptr)
@@ -323,5 +325,5 @@ void VisualizerEditor::saveVisualizerParameters(XmlElement* xml)
 
 void VisualizerEditor::loadVisualizerParameters(XmlElement* xml)
 {
-    
+
 }
\ No newline at end of file
diff --git a/Source/Processors/Editors/WiFiOutputEditor.h b/Source/Processors/Editors/WiFiOutputEditor.h
index 23b6b1811ab7f8afed540df59b9ab283a8a0a430..d31e613ac29ece80352a3cb747acb74ca9dfb171 100755
--- a/Source/Processors/Editors/WiFiOutputEditor.h
+++ b/Source/Processors/Editors/WiFiOutputEditor.h
@@ -20,7 +20,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 */
-    
+
 #ifndef __WIFIOUTPUTEDITOR_H_7161DB44__
 #define __WIFIOUTPUTEDITOR_H_7161DB44__
 
diff --git a/Source/Processors/FileReader.cpp b/Source/Processors/FileReader.cpp
index f8c2929e82a22ea433ce17ccfd16350d1c8d34c4..08bcddb4cae1bc991f80927e998efb6dfb49dbe9 100644
--- a/Source/Processors/FileReader.cpp
+++ b/Source/Processors/FileReader.cpp
@@ -29,36 +29,38 @@ FileReader::FileReader()
     : GenericProcessor("File Reader")
 {
 
-	input = 0;
-	timestamp = 0; 
+    input = 0;
+    timestamp = 0;
 
-	enabledState(false);
+    enabledState(false);
 
 }
 
 FileReader::~FileReader()
 {
-	if (input)
+    if (input)
         fclose(input);
 }
 
 AudioProcessorEditor* FileReader::createEditor()
 {
-	editor = new FileReaderEditor(this, true);
+    editor = new FileReaderEditor(this, true);
 
-	return editor;
+    return editor;
 
 }
 
 bool FileReader::isReady()
 {
-	if (input == 0)
-	{
-		sendActionMessage("No file selected in File Reader.");
-		return false;
-	} else {
-		return true;
-	}
+    if (input == 0)
+    {
+        sendActionMessage("No file selected in File Reader.");
+        return false;
+    }
+    else
+    {
+        return true;
+    }
 }
 
 
@@ -80,7 +82,7 @@ float FileReader::getDefaultBitVolts()
 void FileReader::enabledState(bool t)
 {
 
-	isEnabled = t;
+    isEnabled = t;
 
 }
 
@@ -128,7 +130,7 @@ void FileReader::updateSettings()
 void FileReader::process(AudioSampleBuffer& buffer, MidiBuffer& events, int& nSamples)
 {
 
-	uint8 data[8];
+    uint8 data[8];
     memcpy(data, &timestamp, 8);
 
     // generate timestamp
@@ -143,24 +145,24 @@ void FileReader::process(AudioSampleBuffer& buffer, MidiBuffer& events, int& nSa
 
     // FIXME: needs to account for the fact that the ratio might not be an exact
     //        integer value
-	int samplesNeeded = (int) float(buffer.getNumSamples()) * (getDefaultSampleRate()/44100.0f); 
+    int samplesNeeded = (int) float(buffer.getNumSamples()) * (getDefaultSampleRate()/44100.0f);
 
-	 if (ftell(input) >= lengthOfInputFile - samplesNeeded)
-     {
+    if (ftell(input) >= lengthOfInputFile - samplesNeeded)
+    {
         rewind(input);
-     }
+    }
 
-     size_t numRead = fread(readBuffer, 2, samplesNeeded*buffer.getNumChannels(), input);
+    size_t numRead = fread(readBuffer, 2, samplesNeeded*buffer.getNumChannels(), input);
 
     int chan = 0;
     int samp = 0;
 
     for (size_t n = 0; n < numRead; n++)
     {
-        
+
         if (chan == buffer.getNumChannels())
         {
-        	samp++;
+            samp++;
             timestamp++;
             chan = 0;
         }
@@ -194,18 +196,18 @@ void FileReader::loadCustomParametersFromXml()
 
     if (parametersAsXml != nullptr)
     {
-        // use parametersAsXml to restore state 
+        // use parametersAsXml to restore state
 
         forEachXmlChildElement(*parametersAsXml, xmlNode)
         {
-           if (xmlNode->hasTagName("FILENAME"))
+            if (xmlNode->hasTagName("FILENAME"))
             {
                 String filepath = xmlNode->getStringAttribute("path");
-               FileReaderEditor* fre = (FileReaderEditor*) getEditor();
+                FileReaderEditor* fre = (FileReaderEditor*) getEditor();
                 fre->setFile(filepath);
 
             }
-        }   
+        }
     }
 
 }
\ No newline at end of file
diff --git a/Source/Processors/FileReader.h b/Source/Processors/FileReader.h
index d688cba448837ae6d46f1504021a099d79e7f711..87eff3f2046066493b6bb49a7df20d128a56c4c0 100644
--- a/Source/Processors/FileReader.h
+++ b/Source/Processors/FileReader.h
@@ -64,7 +64,7 @@ public:
 
     bool isSource()
     {
-    	return true;
+        return true;
     }
 
     void enabledState(bool t);
@@ -81,9 +81,9 @@ public:
 
 private:
 
-	uint64 timestamp;
+    uint64 timestamp;
 
-	int lengthOfInputFile;
+    int lengthOfInputFile;
     FILE* input;
 
     int16 readBuffer[BUFFER_SIZE];
diff --git a/Source/Processors/FilterNode.cpp b/Source/Processors/FilterNode.cpp
index ac453c109920bb17a2d5ac45afb565a44f1aa7a0..64ebf7e2574343dcb3741a27d3c797da0a1e968c 100755
--- a/Source/Processors/FilterNode.cpp
+++ b/Source/Processors/FilterNode.cpp
@@ -133,7 +133,7 @@ void FilterNode::updateSettings()
 
         for (int n = 0; n < getNumInputs(); n++)
         {
-            std::cout << "Creating filter number " << n << std::endl;
+           // std::cout << "Creating filter number " << n << std::endl;
 
             filters.add(new Dsp::SmoothedFilterDesign
                         <Dsp::Butterworth::Design::BandPass 	// design type
@@ -142,7 +142,7 @@ void FilterNode::updateSettings()
                         Dsp::DirectFormII>						// realization
                         (1));
 
-            
+
             //Parameter& p1 =  parameters.getReference(0);
             //p1.setValue(600.0f, n);
             //Parameter& p2 =  parameters.getReference(1);
@@ -189,20 +189,20 @@ void FilterNode::setParameter(int parameterIndex, float newValue)
     if (newValue <= 0.01 || newValue >= 10000.0f)
         return;
 
-    std::cout << "Setting channel " << currentChannel;// << std::endl;
+    //std::cout << "Setting channel " << currentChannel;// << std::endl;
 
     if (parameterIndex == 0)
     {
-        std::cout << " low cut to " << newValue << std::endl;
+       // std::cout << " low cut to " << newValue << std::endl;
         lowCuts.set(currentChannel,newValue);
     }
     else
     {
-        std::cout << " high cut to " << newValue << std::endl;
+        //std::cout << " high cut to " << newValue << std::endl;
         highCuts.set(currentChannel,newValue);
     }
 
-    std::cout << newValue << std::endl;
+    //std::cout << newValue << std::endl;
 
     setFilterParameters(lowCuts[currentChannel],
                         highCuts[currentChannel],
@@ -221,7 +221,7 @@ void FilterNode::setParameter(int parameterIndex, float newValue)
 
     // std::cout << float(p1[currentChannel]) << " ";
     // std::cout << float(p2[currentChannel]) << std::endl;
-    
+
     // if (parameterIndex == 0) {
     // 	parameters[0].setValue(newValue, currentChannel);
     // 	setFilterParameters(newValue, parameters[0][currentChannel], currentChannel);
@@ -229,6 +229,7 @@ void FilterNode::setParameter(int parameterIndex, float newValue)
     // 	parameters[1].setValue(newValue, currentChannel);
     // 	setFilterParameters(lowCuts[currentChannel], newValue, currentChannel);
     // }
+
     editor->updateParameterButtons(parameterIndex);
 
 }
@@ -255,19 +256,19 @@ void FilterNode::saveCustomChannelParametersToXml(XmlElement* channelInfo, int c
     {
         //std::cout << "Saving custom parameters for filter node." << std::endl;
 
-         XmlElement* channelParams = channelInfo->createNewChildElement("PARAMETERS");
-         channelParams->setAttribute("highcut",highCuts[channelNumber]);
-         channelParams->setAttribute("lowcut",lowCuts[channelNumber]);
+        XmlElement* channelParams = channelInfo->createNewChildElement("PARAMETERS");
+        channelParams->setAttribute("highcut",highCuts[channelNumber]);
+        channelParams->setAttribute("lowcut",lowCuts[channelNumber]);
     }
 
 }
-    
+
 void FilterNode::loadCustomChannelParametersFromXml(XmlElement* channelInfo, bool isEventChannel)
 {
 
-     int channelNum = channelInfo->getIntAttribute("number");
+    int channelNum = channelInfo->getIntAttribute("number");
 
-     if (!isEventChannel)
+    if (!isEventChannel)
     {
         forEachXmlChildElement(*channelInfo, subNode)
         {
@@ -277,11 +278,11 @@ void FilterNode::loadCustomChannelParametersFromXml(XmlElement* channelInfo, boo
                 lowCuts.set(channelNum, subNode->getDoubleAttribute("lowcut",600.0f));
 
                 setFilterParameters(lowCuts[channelNum],
-                        highCuts[channelNum],
-                        channelNum);
+                                    highCuts[channelNum],
+                                    channelNum);
 
             }
-        } 
+        }
     }
 
 
diff --git a/Source/Processors/FilterNode.h b/Source/Processors/FilterNode.h
index 5e4f7f425a8a9fff6c8195dfaa1f90dae3425ee4..87851c9b5260de252777986f14a0e4c7d340f6fb 100755
--- a/Source/Processors/FilterNode.h
+++ b/Source/Processors/FilterNode.h
@@ -62,7 +62,7 @@ public:
     void updateSettings();
 
     void saveCustomChannelParametersToXml(XmlElement* channelInfo, int channelNumber, bool isEventChannel);
-    
+
     void loadCustomChannelParametersFromXml(XmlElement* channelInfo, bool isEventChannel);
 
 private:
diff --git a/Source/Processors/GenericProcessor.cpp b/Source/Processors/GenericProcessor.cpp
index e935833ecf9a1767d6df54f4665ca0194558520f..6bfa53c46b655ab04ea8bd11e2579c993c3e538d 100755
--- a/Source/Processors/GenericProcessor.cpp
+++ b/Source/Processors/GenericProcessor.cpp
@@ -532,10 +532,10 @@ void GenericProcessor::saveToXml(XmlElement* parentElement)
     {
         saveChannelParametersToXml(parentElement, i, true);
 
-         // channelName=/**String("EventCh:")+*/String(i);
-         // channelChildNode = parentElement->createNewChildElement("EVENTCHANNEL");
-         // channelChildNode->setAttribute("name", channelName);
-         // saveParametersToChannelsXml(channelChildNode, i);
+        // channelName=/**String("EventCh:")+*/String(i);
+        // channelChildNode = parentElement->createNewChildElement("EVENTCHANNEL");
+        // channelChildNode->setAttribute("name", channelName);
+        // saveParametersToChannelsXml(channelChildNode, i);
     }
 
     // Save editor parameters:
@@ -569,12 +569,14 @@ void GenericProcessor::saveChannelParametersToXml(XmlElement* parentElement, int
 
         saveCustomChannelParametersToXml(channelInfo, channelNumber);
 
-    } else {
+    }
+    else
+    {
 
         XmlElement* channelInfo = parentElement->createNewChildElement("EVENTCHANNEL");
         channelInfo->setAttribute("name", String(channelNumber));
         channelInfo->setAttribute("number", channelNumber);
-    
+
         saveCustomChannelParametersToXml(channelInfo, channelNumber, true);
 
     }
@@ -598,7 +600,7 @@ void GenericProcessor::saveChannelParametersToXml(XmlElement* parentElement, int
     //     parameterValue = parameterVar.toString();
     //     parameterChildNode->addTextElement(parameterValue);
     // }
-    
+
 }
 
 void GenericProcessor::saveCustomChannelParametersToXml(XmlElement* channelInfo, int channelNum, bool isEventChannel)
@@ -616,34 +618,36 @@ void GenericProcessor::loadFromXml()
     if (!paramsWereLoaded)
     {
 
-    if (parametersAsXml != nullptr)
-    {
-        // use parametersAsXml to restore state 
-        loadCustomParametersFromXml();
-
-        forEachXmlChildElement(*parametersAsXml, xmlNode)
+        if (parametersAsXml != nullptr)
         {
-           if (xmlNode->hasTagName("CHANNEL"))
-            {
+            // use parametersAsXml to restore state
+            loadCustomParametersFromXml();
 
-                loadChannelParametersFromXml(xmlNode);
-            } else if (xmlNode->hasTagName("EVENTCHANNEL"))
+            forEachXmlChildElement(*parametersAsXml, xmlNode)
             {
+                if (xmlNode->hasTagName("CHANNEL"))
+                {
 
-                loadChannelParametersFromXml(xmlNode, true);
-                 
-            } else if (xmlNode->hasTagName("EDITOR"))
-            {
-                getEditor()->loadEditorParameters(xmlNode);
-            }
+                    loadChannelParametersFromXml(xmlNode);
+                }
+                else if (xmlNode->hasTagName("EVENTCHANNEL"))
+                {
 
-        }   
-    }
+                    loadChannelParametersFromXml(xmlNode, true);
+
+                }
+                else if (xmlNode->hasTagName("EDITOR"))
+                {
+                    getEditor()->loadEditorParameters(xmlNode);
+                }
+
+            }
+        }
 
     }
 
     paramsWereLoaded = true;
-    
+
 }
 
 void GenericProcessor::loadChannelParametersFromXml(XmlElement* channelInfo, bool isEventChannel)
@@ -664,7 +668,7 @@ void GenericProcessor::loadChannelParametersFromXml(XmlElement* channelInfo, boo
                                                       subNode->getBoolAttribute("record"),
                                                       subNode->getBoolAttribute("audio"));
             }
-        } 
+        }
     }
 
     loadCustomChannelParametersFromXml(channelInfo, isEventChannel);
@@ -675,7 +679,7 @@ void GenericProcessor::loadChannelParametersFromXml(XmlElement* channelInfo, boo
 
 void GenericProcessor::loadCustomParametersFromXml()
 {
-    
+
 }
 
 void GenericProcessor::loadCustomChannelParametersFromXml(XmlElement* channelInfo, bool isEventChannel)
diff --git a/Source/Processors/GenericProcessor.h b/Source/Processors/GenericProcessor.h
index 29c4dd70802e67da16c5a0945d9a1977bb4e2f70..2179dc26aec8a54d6ce86d7ea5c88619c2ab1057 100755
--- a/Source/Processors/GenericProcessor.h
+++ b/Source/Processors/GenericProcessor.h
@@ -496,7 +496,10 @@ public:
     OwnedArray<Channel> eventChannels;
 
     /** Returns total number of channels */
-    int totalNumberOfChannels(){return channels.size()+eventChannels.size();}
+    int totalNumberOfChannels()
+    {
+        return channels.size()+eventChannels.size();
+    }
 
     /** Settings used by most processors. */
     struct ProcessorSettings
@@ -561,7 +564,7 @@ public:
     /** Load custom parameters for each channel. */
     virtual void loadCustomChannelParametersFromXml(XmlElement* channelElement, bool isEventChannel=false);
 
-     /** Holds loaded parameters */
+    /** Holds loaded parameters */
     XmlElement* parametersAsXml;
 
 private:
diff --git a/Source/Processors/LfpDisplayNode.cpp b/Source/Processors/LfpDisplayNode.cpp
index 16d017aa37180d167ece6f13a2f47c69fb9b5fe4..4b5a3a12264addb0a9e9f9fb77c401fe56c2462a 100755
--- a/Source/Processors/LfpDisplayNode.cpp
+++ b/Source/Processors/LfpDisplayNode.cpp
@@ -34,22 +34,6 @@ LfpDisplayNode::LfpDisplayNode()
     displayBuffer = new AudioSampleBuffer(8, 100);
     eventBuffer = new MidiBuffer();
 
-    // Array<var> timeBaseValues;
-    // timeBaseValues.add(1);
-    // timeBaseValues.add(2);
-    // timeBaseValues.add(5);
-    // timeBaseValues.add(10);
-
-    // parameters.add(Parameter("timebase",timeBaseValues, 1, 0));//true);//a,0);
-
-    // Array<var> displayGainValues;
-    // displayGainValues.add(1);
-    // displayGainValues.add(2);
-    // displayGainValues.add(4);
-    // displayGainValues.add(8);
-
-    // parameters.add(Parameter("display gain",displayGainValues, 1, 1));//true);//a,0);
-
     arrayOfOnes = new float[5000];
 
     for (int n = 0; n < 5000; n++)
@@ -61,8 +45,7 @@ LfpDisplayNode::LfpDisplayNode()
 
 LfpDisplayNode::~LfpDisplayNode()
 {
-    //deleteAndZero(displayBuffer);
-    //deleteAndZero(eventBuffer);
+
 }
 
 AudioProcessorEditor* LfpDisplayNode::createEditor()
diff --git a/Source/Processors/PhaseDetector.cpp b/Source/Processors/PhaseDetector.cpp
index 2a2e149b0a81119ac616e98691aafd4f36df622d..84e86258b9dbd318a0653227d374ffcd463cc11d 100644
--- a/Source/Processors/PhaseDetector.cpp
+++ b/Source/Processors/PhaseDetector.cpp
@@ -91,29 +91,29 @@ void PhaseDetector::handleEvent(int eventType, MidiMessage& event, int sampleNum
 
     //std::cout << "GOT EVENT." << std::endl;
 
-     if (eventType == TTL)
-     {
-         const uint8* dataptr = event.getRawData();
+    if (eventType == TTL)
+    {
+        const uint8* dataptr = event.getRawData();
 
-         // int eventNodeId = *(dataptr+1);
-         int eventId = *(dataptr+2);
-         int eventChannel = *(dataptr+3);
-         //int eventTime = event.getTimeStamp();
+        // int eventNodeId = *(dataptr+1);
+        int eventId = *(dataptr+2);
+        int eventChannel = *(dataptr+3);
+        //int eventTime = event.getTimeStamp();
 
-    //     //	std::cout << "Received event from " << eventNodeId << ", channel "
-    //     //          << eventChannel << ", with ID " << eventId << std::endl;
+        //     //	std::cout << "Received event from " << eventNodeId << ", channel "
+        //     //          << eventChannel << ", with ID " << eventId << std::endl;
 
-    //     if (eventId == 1 && eventChannel == 5)
-    //     {
-    //         canBeTriggered = true;
-    //     }
-         if (eventId == 0 && eventChannel == 5)
-         {
-             triggerOnPeak = randomNumberGenerator.nextBool();
+        //     if (eventId == 1 && eventChannel == 5)
+        //     {
+        //         canBeTriggered = true;
+        //     }
+        if (eventId == 0 && eventChannel == 5)
+        {
+            triggerOnPeak = randomNumberGenerator.nextBool();
 
-         }
+        }
 
-     }
+    }
 
 }
 
@@ -134,7 +134,7 @@ void PhaseDetector::process(AudioSampleBuffer& buffer,
 
             if (!triggerOnPeak)
                 sample = -sample; // invert
-               
+
 
             if (sample > lastSample && !isIncreasing)
             {
@@ -151,11 +151,11 @@ void PhaseDetector::process(AudioSampleBuffer& buffer,
 
 
                 //std::cout << "GOT EVENT." << std::endl;
-                
+
                 // entering falling phase (just reached peak or trough)
                 //if (true)
                 addEvent(events, TTL, i, 1, 3);
-                
+
 
                 peakIntervals[numPeakIntervals % NUM_INTERVALS] = nSamplesSinceLastPeak;
 
@@ -172,10 +172,10 @@ void PhaseDetector::process(AudioSampleBuffer& buffer,
                 // either rising or falling
                 nSamplesSinceLastPeak++;
 
-                 if (nSamplesSinceLastPeak == 500)
-                 {
-                     addEvent(events, TTL, i, 0, 3);
-                 }
+                if (nSamplesSinceLastPeak == 500)
+                {
+                    addEvent(events, TTL, i, 0, 3);
+                }
 
             }
 
diff --git a/Source/Processors/PhaseDetector.h b/Source/Processors/PhaseDetector.h
index fcb29bbd4e09aba185e2c455d31d3ae449ab8282..9942881b22337ac728011ff3b556aa968d2c5fa1 100644
--- a/Source/Processors/PhaseDetector.h
+++ b/Source/Processors/PhaseDetector.h
@@ -48,7 +48,7 @@ public:
 
     void process(AudioSampleBuffer& buffer, MidiBuffer& midiMessages, int& nSamples);
     void setParameter(int parameterIndex, float newValue);
-    
+
     AudioProcessorEditor* createEditor();
 
     bool hasEditor() const
@@ -68,9 +68,9 @@ private:
 
     bool isIncreasing;
 
-	bool triggerOnPeak;
+    bool triggerOnPeak;
 
-	bool canBeTriggered;
+    bool canBeTriggered;
 
     void handleEvent(int eventType, MidiMessage& event, int sampleNum);
 
diff --git a/Source/Processors/ProcessorGraph.cpp b/Source/Processors/ProcessorGraph.cpp
index fa997e55df66f1858981c0896e679b295974b26a..1af9de78f6844ae5b5837a25b190cd762601d3fe 100644
--- a/Source/Processors/ProcessorGraph.cpp
+++ b/Source/Processors/ProcessorGraph.cpp
@@ -79,12 +79,12 @@ void ProcessorGraph::createDefaultNodes()
     // add record node -- sends output to disk
     RecordNode* recn = new RecordNode();
     recn->setNodeId(RECORD_NODE_ID);
-   
+
 
     // add audio node -- takes all inputs and selects those to be used for audio monitoring
     AudioNode* an = new AudioNode();
     an->setNodeId(AUDIO_NODE_ID);
-    
+
 
     // add audio resampling node -- resamples continuous signals to 44.1kHz
     AudioResamplingNode* arn = new AudioResamplingNode();
@@ -431,7 +431,7 @@ GenericProcessor* ProcessorGraph::createProcessorFromDescription(String& descrip
     {
 
         if (subProcessorType.equalsIgnoreCase("RHA2000-EVAL") ||
-           // subProcessorType.equalsIgnoreCase("File Reader") ||
+            // subProcessorType.equalsIgnoreCase("File Reader") ||
             subProcessorType.equalsIgnoreCase("Custom FPGA") ||
             subProcessorType.equalsIgnoreCase("Rhythm FPGA"))
         {
diff --git a/Source/Processors/ProcessorGraph.h b/Source/Processors/ProcessorGraph.h
index bd232b9236be2ff0d74f9bca7e051d0e7629effa..44775bf8fe2f8c11bc9b7b8aa92be66357bd3e22 100755
--- a/Source/Processors/ProcessorGraph.h
+++ b/Source/Processors/ProcessorGraph.h
@@ -94,7 +94,7 @@ private:
     };
 
     void createDefaultNodes();
-    
+
     void clearConnections();
 
 };
diff --git a/Source/Processors/PulsePalOutput.cpp b/Source/Processors/PulsePalOutput.cpp
index d7f88790471ae64d203d78897b2a38f31ec2cd7c..8ca791d0384647e79f07f9ed60e9d0d6abd3787e 100644
--- a/Source/Processors/PulsePalOutput.cpp
+++ b/Source/Processors/PulsePalOutput.cpp
@@ -60,7 +60,7 @@ void PulsePalOutput::handleEvent(int eventType, MidiMessage& event, int sampleNu
 {
     if (eventType == TTL)
     {
-      //  std::cout << "Received an event!" << std::endl;
+        //  std::cout << "Received an event!" << std::endl;
 
         const uint8* dataptr = event.getRawData();
 
@@ -107,7 +107,9 @@ void PulsePalOutput::setParameter(int parameterIndex, float newValue)
             if (newValue < 0)
             {
                 channelState.set(channelToChange, true);
-            } else {
+            }
+            else
+            {
                 channelState.set(channelToChange, false);
             }
 
@@ -119,8 +121,8 @@ void PulsePalOutput::setParameter(int parameterIndex, float newValue)
 }
 
 void PulsePalOutput::process(AudioSampleBuffer& buffer,
-                         MidiBuffer& events,
-                         int& nSamples)
+                             MidiBuffer& events,
+                             int& nSamples)
 {
 
     checkForEvents(events);
diff --git a/Source/Processors/PulsePalOutput.h b/Source/Processors/PulsePalOutput.h
index ed84b052491f442132dc6aac42f32e9592dec092..85f192ccaf9b2b36bf88128b1cc6f335f9218131 100644
--- a/Source/Processors/PulsePalOutput.h
+++ b/Source/Processors/PulsePalOutput.h
@@ -31,7 +31,7 @@
 
 /**
 
-  Allows the signal chain to send outputs to the Pulse Pal 
+  Allows the signal chain to send outputs to the Pulse Pal
   from Lucid Biosystems (www.lucidbiosystems.com)
 
   @see GenericProcessor, PulsePalOutputEditor, PulsePal
diff --git a/Source/Processors/RecordNode.cpp b/Source/Processors/RecordNode.cpp
index 8115f6ac0d7d0c71f14cc7e7a9c012842a50edfa..447d780541dd542a3b6345a6f92bea7b7f836d1b 100755
--- a/Source/Processors/RecordNode.cpp
+++ b/Source/Processors/RecordNode.cpp
@@ -312,7 +312,7 @@ void RecordNode::setParameter(int parameterIndex, float newValue)
 
         openFile(eventChannel);
 
-         sampleCount = 0; // reset sample count
+        sampleCount = 0; // reset sample count
 
         // create / open necessary files
         for (int i = 0; i < channelPointers.size(); i++)
@@ -418,7 +418,7 @@ void RecordNode::openFile(Channel* ch)
         std::cout << "File already exists, just opening." << std::endl;
     }
 
-    
+
 
     //To avoid a race condition resulting on data written before the header,
     //do not assign the channel pointer until the header has been written
@@ -476,8 +476,8 @@ String RecordNode::generateHeader(Channel* ch)
 
     header += "header.sampleRate = ";
     header += String(channelPointers[0]->sampleRate); // all channels need to have the
-                                                      // same sample rate under the current
-                                                      // scheme
+    // same sample rate under the current
+    // scheme
     header += ";\n";
     header += "header.blockLength = ";
     header += BLOCK_LENGTH;
@@ -543,7 +543,7 @@ float RecordNode::getFreeSpace()
 
 void RecordNode::writeContinuousBuffer(float* data, int nSamples, int channel)
 {
-    
+
     // check to see if the file exists
     if (channelPointers[channel]->file == NULL)
         return;
@@ -556,7 +556,7 @@ void RecordNode::writeContinuousBuffer(float* data, int nSamples, int channel)
     }
     AudioDataConverters::convertFloatToInt16BE(continuousDataFloatBuffer, continuousDataIntegerBuffer, nSamples);
 
-    // 
+    //
     //int16 samps = (int16) nSamples;
 
     if (sampleCount == 0)
@@ -584,14 +584,14 @@ void RecordNode::writeTimestampAndSampleCount(FILE* file)
     int16 samps = BLOCK_LENGTH;
 
     fwrite(&timestamp,                       // ptr
-            8,                               // size of each element
-            1,                               // count
-            file); // ptr to FILE object
+           8,                               // size of each element
+           1,                               // count
+           file); // ptr to FILE object
 
     fwrite(&samps,                           // ptr
-            2,                               // size of each element
-            1,                               // count
-            file); // ptr to FILE object
+           2,                               // size of each element
+           1,                               // count
+           file); // ptr to FILE object
 
 }
 
@@ -637,10 +637,10 @@ void RecordNode::handleEvent(int eventType, MidiMessage& event, int samplePositi
     if (eventType == TTL)
     {
         writeEventBuffer(event, samplePosition);
-    } 
+    }
     else if (eventType == TIMESTAMP)
     {
-    	const uint8* dataptr = event.getRawData();
+        const uint8* dataptr = event.getRawData();
 
         // std::cout << (int) *(dataptr + 11) << " " <<
         //             (int) *(dataptr + 10) << " " <<
@@ -652,7 +652,7 @@ void RecordNode::handleEvent(int eventType, MidiMessage& event, int samplePositi
         //             (int) *(dataptr + 4) << std::endl;
 
 
-    	memcpy(&timestamp, dataptr + 4, 8); // remember to skip first four bytes
+        memcpy(&timestamp, dataptr + 4, 8); // remember to skip first four bytes
     }
 
 }
@@ -685,7 +685,7 @@ void RecordNode::process(AudioSampleBuffer& buffer,
         {
 
             while (samplesWritten < nSamples)
-            { 
+            {
 
                 int numSamplesToWrite = nSamples - samplesWritten;
 
@@ -709,7 +709,9 @@ void RecordNode::process(AudioSampleBuffer& buffer,
                     samplesWritten += numSamplesToWrite;
                     sampleCount += numSamplesToWrite;
 
-                } else {
+                }
+                else
+                {
 
                     numSamplesToWrite = BLOCK_LENGTH - sampleCount;
 
@@ -735,7 +737,7 @@ void RecordNode::process(AudioSampleBuffer& buffer,
             }
         }
 
-      //  std::cout << nSamples << " " << samplesWritten << " " << sampleCount << std::endl;
+        //  std::cout << nSamples << " " << samplesWritten << " " << sampleCount << std::endl;
 
         return;
 
diff --git a/Source/Processors/RecordNode.h b/Source/Processors/RecordNode.h
index ac44861133170b90cf7806f405a1319af4c039ce..7e3efe36bf2123e49f754c59cc2906f9c5e4b99e 100755
--- a/Source/Processors/RecordNode.h
+++ b/Source/Processors/RecordNode.h
@@ -102,14 +102,17 @@ public:
     */
     void createNewDirectory();
 
-    File getDataDirectory() {return rootFolder;}
+    File getDataDirectory()
+    {
+        return rootFolder;
+    }
 
     /** Signals when to create a new data directory when recording starts.*/
     bool newDirectoryNeeded;
 
     bool isRecording;
 
-     /** Generate a Matlab-compatible datestring */
+    /** Generate a Matlab-compatible datestring */
     String generateDateString();
 
 
@@ -173,7 +176,7 @@ private:
     /** Generates a default directory name, based on the current date and time */
     String generateDirectoryName();
 
-   
+
     /** Generate filename for a given channel */
     void updateFileName(Channel* ch);
 
diff --git a/Source/Processors/ReferenceNode.cpp b/Source/Processors/ReferenceNode.cpp
index 94bf9bdfde9d44288c677e9289bfc76b42a0e18b..fc87145ba62053a5b0a01cd9b4b6ef9d982d7011 100644
--- a/Source/Processors/ReferenceNode.cpp
+++ b/Source/Processors/ReferenceNode.cpp
@@ -82,7 +82,7 @@ void ReferenceNode::process(AudioSampleBuffer& buffer,
                                 0, // sourceStartSample
                                 nSamples, // numSamples
                                 -1.0f // gain to apply to source
-                                );
+                               );
 
         for (int i = 0; i < buffer.getNumChannels(); i++)
         {
@@ -94,9 +94,9 @@ void ReferenceNode::process(AudioSampleBuffer& buffer,
                            0, // sourceStartSample
                            nSamples, // numSamples
                            1.0f // gain to apply to source
-                           );
+                          );
         }
-        
+
     }
 
 }
diff --git a/Source/Processors/Serial/PulsePal.cpp b/Source/Processors/Serial/PulsePal.cpp
index dc3552f210edb7cdfea89d3f7a04ff0291bf39c3..03a2ca9e821f875786e68ef68eb7bac410655079 100644
--- a/Source/Processors/Serial/PulsePal.cpp
+++ b/Source/Processors/Serial/PulsePal.cpp
@@ -42,17 +42,17 @@ PulsePal::PulsePal()
 PulsePal::~PulsePal()
 {
 
-	serial.close();
+    serial.close();
 }
 
 void PulsePal::initialize()
 {
 
-	std::cout << "Searching for Pulse Pal..." << std::endl;
+    std::cout << "Searching for Pulse Pal..." << std::endl;
 
 
     //
-	// lsusb shows Device 104: ID 1eaf:0004
+    // lsusb shows Device 104: ID 1eaf:0004
     // updated udev rules file, but still need to run as root -- no idea why
     //
     // try this instead: sudo chmod o+rw /dev/ttyACM0
@@ -60,25 +60,25 @@ void PulsePal::initialize()
     // works fine, but you have to re-do it every time
     //
 
-	vector<ofSerialDeviceInfo> devices = serial.getDeviceList();
+    vector<ofSerialDeviceInfo> devices = serial.getDeviceList();
 
-	bool foundDevice = false;
+    bool foundDevice = false;
 
-	for (int devNum; devNum < devices.size(); devNum++)
-	{
-		int id = devices[devNum].getDeviceID();
-		string path = devices[devNum].getDevicePath();
+    for (int devNum; devNum < devices.size(); devNum++)
+    {
+        int id = devices[devNum].getDeviceID();
+        string path = devices[devNum].getDevicePath();
         string name = devices[devNum].getDeviceName();
 
-       // std::cout << "Device name: " << name << std::endl;
+        // std::cout << "Device name: " << name << std::endl;
 
         //#if (defined TARGET_LINUX)
-            string acm0 = "ACM0";
+        string acm0 = "ACM0";
         //#endif
 
         //#if (defined TARGET_OSX)
         //    string acm0 = "usbmodemfa131";
-       // #endif
+        // #endif
 
 
         size_t index = path.find(acm0);
@@ -90,9 +90,9 @@ void PulsePal::initialize()
 
             unsigned char bytesToWrite = 59;
 
-           serial.writeByte(bytesToWrite);
+            serial.writeByte(bytesToWrite);
 
-          // std::cout << "error number: " << a << std::endl;
+            // std::cout << "error number: " << a << std::endl;
 
             // while (serial.available() == 0)
             // {
@@ -104,7 +104,7 @@ void PulsePal::initialize()
             std::cout << "Got response: " << (int) resp << std::endl;
 
             if (resp == 254)
-                      {
+            {
                 std::cout << "FOUND A PULSE PAL." << std::endl;
                 foundDevice = true;
             }
@@ -117,162 +117,162 @@ void PulsePal::initialize()
             break;
         }
 
-	}
+    }
 
 
 }
 
 void PulsePal::setPhase1Duration(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
-	program(channel, 0, timeInMicroseconds);
+    constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
+    program(channel, 0, timeInMicroseconds);
 }
 
 void PulsePal::setInterPhaseInterval(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
-	program(channel, 1, timeInMicroseconds);
+    constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
+    program(channel, 1, timeInMicroseconds);
 }
 
 void PulsePal::setPhase2Duration(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
-	program(channel, 2, timeInMicroseconds);
+    constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
+    program(channel, 2, timeInMicroseconds);
 }
 
 void PulsePal::setInterPulseInterval(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
-	program(channel, 3, timeInMicroseconds);
+    constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
+    program(channel, 3, timeInMicroseconds);
 }
 
 void PulsePal::setBurstDuration(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, ZERO_uS, MAX_uS);
-	program(channel, 4, timeInMicroseconds);
+    constrain(&timeInMicroseconds, ZERO_uS, MAX_uS);
+    program(channel, 4, timeInMicroseconds);
 }
 
 void PulsePal::setBurstInterval(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, ZERO_uS, MAX_uS);
-	program(channel, 5, timeInMicroseconds);
+    constrain(&timeInMicroseconds, ZERO_uS, MAX_uS);
+    program(channel, 5, timeInMicroseconds);
 }
 
 void PulsePal::setStimulusTrainDuration(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
-	program(channel, 6, timeInMicroseconds);
+    constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
+    program(channel, 6, timeInMicroseconds);
 }
 
 void PulsePal::setStimulusTrainDelay(uint8_t channel, uint32_t timeInMicroseconds)
 {
-	constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
-	program(channel, 7, timeInMicroseconds);
+    constrain(&timeInMicroseconds, FIFTY_uS, MAX_uS);
+    program(channel, 7, timeInMicroseconds);
 }
 
 void PulsePal::setBiphasic(uint8_t channel, bool isBiphasic)
 {
-	uint8_t command = 0;
+    uint8_t command = 0;
 
-	if (isBiphasic)
-	{
-		command = 1;
-	}
+    if (isBiphasic)
+    {
+        command = 1;
+    }
 
-	program(channel, 8, command);
+    program(channel, 8, command);
 }
 
 void PulsePal::setPhase1Voltage(uint8_t channel, float voltage)
 {
-	program(channel, 9, voltageToByte(voltage));
+    program(channel, 9, voltageToByte(voltage));
 }
 
 void PulsePal::setPhase2Voltage(uint8_t channel, float voltage)
 {
-	program(channel, 10, voltageToByte(voltage));
+    program(channel, 10, voltageToByte(voltage));
 }
 
 void PulsePal::updateDisplay(string line1, string line2)
 {
-	uint8_t message1 = 85;
+    uint8_t message1 = 85;
 
-	serial.writeByte(message1);
+    serial.writeByte(message1);
 
-	serial.writeBytes((unsigned char*) line1.data(), line1.size());
-	//serial.writeByte(0);
-	//serial.writeByte(RETURN);
-	serial.writeByte(254);
-	serial.writeBytes((unsigned char*) line2.data(), line2.size());
-	//serial.writeByte(0);
-	//serial.writeByte(RETURN);
+    serial.writeBytes((unsigned char*) line1.data(), line1.size());
+    //serial.writeByte(0);
+    //serial.writeByte(RETURN);
+    serial.writeByte(254);
+    serial.writeBytes((unsigned char*) line2.data(), line2.size());
+    //serial.writeByte(0);
+    //serial.writeByte(RETURN);
 
 }
 
 void PulsePal::program(uint8_t channel, uint8_t paramCode, uint32_t paramValue)
 {
-	std::cout << "sending 32-bit message" << std::endl;
+    std::cout << "sending 32-bit message" << std::endl;
 
-	uint8_t message1[3] = {79, paramCode, channel};
+    uint8_t message1[3] = {79, paramCode, channel};
 
-	uint8_t message2[4];
+    uint8_t message2[4];
 
-	// make sure byte order is little-endian:
-	message2[0] = (paramValue & 0xff);
-	message2[1] = (paramValue & 0xff00) >> 8;
-	message2[2] = (paramValue & 0xff0000) >> 16;
-	message2[3] = (paramValue & 0xff00000) >> 24;
+    // make sure byte order is little-endian:
+    message2[0] = (paramValue & 0xff);
+    message2[1] = (paramValue & 0xff00) >> 8;
+    message2[2] = (paramValue & 0xff0000) >> 16;
+    message2[3] = (paramValue & 0xff00000) >> 24;
 
-	serial.writeBytes(message1, 3);
-	serial.writeBytes(message2, 4);
+    serial.writeBytes(message1, 3);
+    serial.writeBytes(message2, 4);
 
-	std::cout << "Message 1: " << (int) message1[0] << " " << (int) message1[1] << " " << (int) message1[2] << std::endl;
-	std::cout << "Message 2: " << (int) message2[0] << " " << (int) message2[1] << " " << (int) message2[2] <<  " " << (int) message2[3] << std::endl;
+    std::cout << "Message 1: " << (int) message1[0] << " " << (int) message1[1] << " " << (int) message1[2] << std::endl;
+    std::cout << "Message 2: " << (int) message2[0] << " " << (int) message2[1] << " " << (int) message2[2] <<  " " << (int) message2[3] << std::endl;
 }
 
 
 void PulsePal::program(uint8_t channel, uint8_t paramCode, uint8_t paramValue)
 {
 
-	std::cout << "sending 8-bit message" << std::endl;
+    std::cout << "sending 8-bit message" << std::endl;
 
-	uint8_t message1[3] = {79, paramCode, channel};
+    uint8_t message1[3] = {79, paramCode, channel};
 
-	serial.writeBytes(message1, 3);
-	serial.writeBytes(&paramValue, 1);
+    serial.writeBytes(message1, 3);
+    serial.writeBytes(&paramValue, 1);
 
-	std::cout << "Message 1: " << (int) message1[0] << " " << (int) message1[1] << " " << (int) message1[2] << std::endl;
-	std::cout << "Message 2: " << paramValue << std::endl;
+    std::cout << "Message 1: " << (int) message1[0] << " " << (int) message1[1] << " " << (int) message1[2] << std::endl;
+    std::cout << "Message 2: " << paramValue << std::endl;
 }
 
 void PulsePal::constrain(uint32_t* value, uint32_t min, uint32_t max)
 {
 
-	// value must be a multiple of 50
-	if (*value % 50 > 0)
-	{
-		*value = *value - (*value % 50);
-	}
+    // value must be a multiple of 50
+    if (*value % 50 > 0)
+    {
+        *value = *value - (*value % 50);
+    }
 
-	if (*value < min)
-	{
-		*value = min;
-	}
+    if (*value < min)
+    {
+        *value = min;
+    }
 
-	if (*value > max)
-	{
-		*value = max;
-	}
+    if (*value > max)
+    {
+        *value = max;
+    }
 
 }
 
 uint8_t PulsePal::voltageToByte(float voltage)
 {
-	// input: -10 to 10 V
-	// output: 0-255
+    // input: -10 to 10 V
+    // output: 0-255
 
-	uint8_t output = (uint8_t) ((voltage+10)/20)*255;
+    uint8_t output = (uint8_t)((voltage+10)/20)*255;
 
-	return output;
+    return output;
 
 }
 
@@ -280,7 +280,7 @@ uint8_t PulsePal::voltageToByte(float voltage)
 void PulsePal::triggerChannel(uint8_t chan)
 {
     const uint8_t code = 1 << (chan-1);
-    
+
     uint8_t bytesToWrite[2] = {84, code};
 
     serial.writeBytes(bytesToWrite, 2);
diff --git a/Source/Processors/Serial/PulsePal.h b/Source/Processors/Serial/PulsePal.h
index 1e758da44bc744771dc15fa627f392e415a83f09..9b8bb2ad0a3fbdaaec11dda7ca97dc3b88423cc9 100644
--- a/Source/Processors/Serial/PulsePal.h
+++ b/Source/Processors/Serial/PulsePal.h
@@ -41,37 +41,37 @@
 class PulsePal
 {
 public:
-	PulsePal();
-	~PulsePal();
+    PulsePal();
+    ~PulsePal();
 
-	void initialize();
+    void initialize();
 
-	void setPhase1Duration(uint8_t channel, uint32_t timeInMicroseconds);
-	void setInterPhaseInterval(uint8_t channel, uint32_t timeInMicroseconds);
-	void setPhase2Duration(uint8_t channel, uint32_t timeInMicroseconds);
-	void setInterPulseInterval(uint8_t channel, uint32_t timeInMicroseconds);
-	void setBurstDuration(uint8_t channel, uint32_t timeInMicroseconds);
-	void setBurstInterval(uint8_t channel, uint32_t timeInMicroseconds);
-	void setStimulusTrainDuration(uint8_t channel, uint32_t timeInMicroseconds);
-	void setStimulusTrainDelay(uint8_t channel, uint32_t timeInMicroseconds);
-	void setBiphasic(uint8_t channel, bool isBiphasic);
-	void setPhase1Voltage(uint8_t channel, float voltage);
-	void setPhase2Voltage(uint8_t channel, float voltage);
+    void setPhase1Duration(uint8_t channel, uint32_t timeInMicroseconds);
+    void setInterPhaseInterval(uint8_t channel, uint32_t timeInMicroseconds);
+    void setPhase2Duration(uint8_t channel, uint32_t timeInMicroseconds);
+    void setInterPulseInterval(uint8_t channel, uint32_t timeInMicroseconds);
+    void setBurstDuration(uint8_t channel, uint32_t timeInMicroseconds);
+    void setBurstInterval(uint8_t channel, uint32_t timeInMicroseconds);
+    void setStimulusTrainDuration(uint8_t channel, uint32_t timeInMicroseconds);
+    void setStimulusTrainDelay(uint8_t channel, uint32_t timeInMicroseconds);
+    void setBiphasic(uint8_t channel, bool isBiphasic);
+    void setPhase1Voltage(uint8_t channel, float voltage);
+    void setPhase2Voltage(uint8_t channel, float voltage);
 
-	void triggerChannel(uint8_t channel);
+    void triggerChannel(uint8_t channel);
 
-	void updateDisplay(string line1, string line2);
+    void updateDisplay(string line1, string line2);
 
 private:
 
-	void constrain(uint32_t* value, uint32_t min, uint32_t max);
+    void constrain(uint32_t* value, uint32_t min, uint32_t max);
 
-	void program(uint8_t channel, uint8_t paramCode, uint32_t paramValue);
-	void program(uint8_t channel, uint8_t paramCode, uint8_t paramValue);
+    void program(uint8_t channel, uint8_t paramCode, uint32_t paramValue);
+    void program(uint8_t channel, uint8_t paramCode, uint8_t paramValue);
 
-	uint8_t voltageToByte(float voltage);
+    uint8_t voltageToByte(float voltage);
 
-	ofSerial serial;
+    ofSerial serial;
 
 };
 
diff --git a/Source/Processors/SourceNode.cpp b/Source/Processors/SourceNode.cpp
index 5a8b53ccc8cd2f88e386c5b6ec1b6465b62bbc46..43fc015df012eff046cceece56dcc3136afe18ac 100755
--- a/Source/Processors/SourceNode.cpp
+++ b/Source/Processors/SourceNode.cpp
@@ -51,7 +51,7 @@ SourceNode::SourceNode(const String& name_)
     }
     else if (getName().equalsIgnoreCase("File Reader"))
     {
-            dataThread = new FileReaderThread(this); 
+        dataThread = new FileReaderThread(this);
     }
     else if (getName().equalsIgnoreCase("Rhythm FPGA"))
     {
@@ -212,14 +212,15 @@ AudioProcessorEditor* SourceNode::createEditor()
     {
         editor = new RHD2000Editor(this, (RHD2000Thread*) dataThread.get(), true);
 
-      //  RHD2000Editor* r2e = (RHD2000Editor*) editor.get();
-      //  r2e->scanPorts();
+        //  RHD2000Editor* r2e = (RHD2000Editor*) editor.get();
+        //  r2e->scanPorts();
     }
-  //  else if (getName().equalsIgnoreCase("File Reader"))
-  //  {
-   //     editor = new FileReaderEditor(this, (FileReaderThread*) dataThread.get(), true);
-   // }
-    else {
+    //  else if (getName().equalsIgnoreCase("File Reader"))
+    //  {
+    //     editor = new FileReaderEditor(this, (FileReaderThread*) dataThread.get(), true);
+    // }
+    else
+    {
         editor = new SourceNodeEditor(this, true);
     }
     return editor;
@@ -330,7 +331,7 @@ void SourceNode::process(AudioSampleBuffer& buffer,
 
     nSamples = inputBuffer->readAllFromBuffer(buffer, &timestamp, eventCodeBuffer, buffer.getNumSamples());
 
-    //std::cout << *buffer.getSampleData(0) << std::endl; 
+    //std::cout << *buffer.getSampleData(0) << std::endl;
 
     //std::cout << "Source node timestamp: " << timestamp << std::endl;
 
@@ -416,7 +417,7 @@ void SourceNode::saveCustomParametersToXml(XmlElement* parentElement)
         FileReaderThread* thread = (FileReaderThread*) dataThread.get();
         childNode->setAttribute("path", thread->getFile());
 
-    }
+    } 
 
 }
 
@@ -425,18 +426,18 @@ void SourceNode::loadCustomParametersFromXml()
 
     if (parametersAsXml != nullptr)
     {
-        // use parametersAsXml to restore state 
+        // use parametersAsXml to restore state
 
         forEachXmlChildElement(*parametersAsXml, xmlNode)
         {
-           if (xmlNode->hasTagName("FILENAME"))
+            if (xmlNode->hasTagName("FILENAME"))
             {
                 String filepath = xmlNode->getStringAttribute("path");
                 FileReaderEditor* fre = (FileReaderEditor*) getEditor();
                 fre->setFile(filepath);
 
-            }
-        }   
+            } 
+        }
     }
 
 }
\ No newline at end of file
diff --git a/Source/Processors/SourceNode.h b/Source/Processors/SourceNode.h
index fa2d66cfe7c9d7e96fbd5deab04032e14f6f648c..4c314d6911311d31fcf69c002927d272a80cc5ba 100755
--- a/Source/Processors/SourceNode.h
+++ b/Source/Processors/SourceNode.h
@@ -88,7 +88,7 @@ public:
     void saveCustomParametersToXml(XmlElement* parentElement);
     void loadCustomParametersFromXml();
 
-     bool tryEnablingEditor();
+    bool tryEnablingEditor();
 
 private:
 
@@ -111,7 +111,7 @@ private:
     int ttlState;
 
     void updateSettings();
-   
+
 
     JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SourceNode);
 
diff --git a/Source/Processors/SpikeDetector.cpp b/Source/Processors/SpikeDetector.cpp
index ce796f79b8d2040b7333b72d0ab270cc33666faa..ea7228c969671af6c073243dc9c93f742eadbd59 100755
--- a/Source/Processors/SpikeDetector.cpp
+++ b/Source/Processors/SpikeDetector.cpp
@@ -206,7 +206,7 @@ void SpikeDetector::setChannel(int electrodeIndex, int channelNum, int newChanne
 {
 
     std::cout << "Setting electrode " << electrodeIndex << " channel " << channelNum <<
-               " to " << newChannel << std::endl;
+              " to " << newChannel << std::endl;
 
     *(electrodes[electrodeIndex]->channels+channelNum) = newChannel;
 }
@@ -235,7 +235,7 @@ void SpikeDetector::setChannelActive(int electrodeIndex, int subChannel, bool ac
         setParameter(98, 1);
     else
         setParameter(98, 0);
-    
+
 }
 
 bool SpikeDetector::isChannelActive(int electrodeIndex, int i)
@@ -263,7 +263,8 @@ void SpikeDetector::setParameter(int parameterIndex, float newValue)
     if (parameterIndex == 99 && currentElectrode > -1)
     {
         *(electrodes[currentElectrode]->thresholds+currentChannelIndex) = newValue;
-    } else if (parameterIndex == 98 && currentElectrode > -1)
+    }
+    else if (parameterIndex == 98 && currentElectrode > -1)
     {
         if (newValue == 0.0f)
             *(electrodes[currentElectrode]->isActive+currentChannelIndex) = false;
@@ -337,7 +338,8 @@ void SpikeDetector::addSpikeEvent(SpikeObject* s, MidiBuffer& eventBuffer, int p
 
     int numBytes = packSpike(s, spikeBuffer, MAX_SPIKE_BUFFER_LEN);
 
-    eventBuffer.addEvent(spikeBuffer, numBytes, peakIndex);
+    if (numBytes > 0)
+        eventBuffer.addEvent(spikeBuffer, numBytes, peakIndex);
 
 }
 
@@ -378,12 +380,14 @@ void SpikeDetector::addWaveformToSpikeObject(SpikeObject* s,
             //std::cout << currentIndex << std::endl;
 
         }
-    } else {
+    }
+    else
+    {
         for (int sample = 0; sample < spikeLength; sample++)
         {
 
-            // insert a blank spike if the 
-            s->data[currentIndex] = 0; 
+            // insert a blank spike if the
+            s->data[currentIndex] = 0;
             currentIndex++;
             sampleIndex++;
 
@@ -634,13 +638,13 @@ void SpikeDetector::saveCustomParametersToXml(XmlElement* parentElement)
 
     for (int i = 0; i < electrodes.size(); i++)
     {
-         XmlElement* electrodeNode = parentElement->createNewChildElement("ELECTRODE");
-         electrodeNode->setAttribute("name", electrodes[i]->name);
-         electrodeNode->setAttribute("numChannels", electrodes[i]->numChannels);
-         electrodeNode->setAttribute("prePeakSamples", electrodes[i]->prePeakSamples);
-         electrodeNode->setAttribute("postPeakSamples", electrodes[i]->postPeakSamples);
+        XmlElement* electrodeNode = parentElement->createNewChildElement("ELECTRODE");
+        electrodeNode->setAttribute("name", electrodes[i]->name);
+        electrodeNode->setAttribute("numChannels", electrodes[i]->numChannels);
+        electrodeNode->setAttribute("prePeakSamples", electrodes[i]->prePeakSamples);
+        electrodeNode->setAttribute("postPeakSamples", electrodes[i]->postPeakSamples);
 
-         for (int j = 0; j < electrodes[i]->numChannels; j++)
+        for (int j = 0; j < electrodes[i]->numChannels; j++)
         {
             XmlElement* channelNode = electrodeNode->createNewChildElement("SUBCHANNEL");
             channelNode->setAttribute("ch",*(electrodes[i]->channels+j));
@@ -658,13 +662,13 @@ void SpikeDetector::loadCustomParametersFromXml()
 
     if (parametersAsXml != nullptr)
     {
-        // use parametersAsXml to restore state 
+        // use parametersAsXml to restore state
 
         int electrodeIndex = -1;
 
         forEachXmlChildElement(*parametersAsXml, xmlNode)
         {
-           if (xmlNode->hasTagName("ELECTRODE"))
+            if (xmlNode->hasTagName("ELECTRODE"))
             {
 
                 electrodeIndex++;
@@ -673,7 +677,7 @@ void SpikeDetector::loadCustomParametersFromXml()
 
                 SpikeDetectorEditor* sde = (SpikeDetectorEditor*) getEditor();
                 sde->addElectrode(channelsPerElectrode);
-                
+
                 setElectrodeName(electrodeIndex+1, xmlNode->getStringAttribute("name"));
 
                 int channelIndex = -1;
@@ -691,7 +695,7 @@ void SpikeDetector::loadCustomParametersFromXml()
                 }
 
             }
-        }   
+        }
     }
 
 }
diff --git a/Source/Processors/Visualization/LfpDisplayCanvas.cpp b/Source/Processors/Visualization/LfpDisplayCanvas.cpp
index 392240da2fd496ab04104d1aa823c0f8092bafb0..7120471bafde82b4276c054320a742dd5d1e4397 100755
--- a/Source/Processors/Visualization/LfpDisplayCanvas.cpp
+++ b/Source/Processors/Visualization/LfpDisplayCanvas.cpp
@@ -28,7 +28,7 @@
 LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
     screenBufferIndex(0), timebase(1.0f), displayGain(1.0f),   timeOffset(0.0f),
     processor(processor_),
-     displayBufferIndex(0)
+    displayBufferIndex(0)
 {
 
     nChans = processor->getNumInputs();
@@ -75,7 +75,7 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
     timebases.add("5.0");
     timebases.add("10.0");
 
-    
+
     spreads.add("10");
     spreads.add("20");
     spreads.add("30");
@@ -110,9 +110,9 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
     // add event display-specific controls (currently just an enable/disable button)
     for (int i = 0; i < 8; i++)
     {
-        
 
-        eventDisplayInterface* eventOptions = new eventDisplayInterface(lfpDisplay, this, i);
+
+        EventDisplayInterface* eventOptions = new EventDisplayInterface(lfpDisplay, this, i);
         eventDisplayInterfaces.add(eventOptions);
         addAndMakeVisible(eventOptions);
         eventOptions->setBounds(500+(floor(i/2)*20), getHeight()-20-(i%2)*20, 40, 20);
@@ -149,7 +149,7 @@ void LfpDisplayCanvas::resized()
     }
 
 
-   // std::cout << "Canvas thinks LfpDisplay should be this high: " 
+    // std::cout << "Canvas thinks LfpDisplay should be this high: "
     //  << lfpDisplay->getTotalHeight() << std::endl;
 
 }
@@ -184,14 +184,14 @@ void LfpDisplayCanvas::update()
     lfpDisplay->setNumChannels(nChans);
 
     // update channel names
-	for (int i = 0; i < processor->getNumInputs(); i++)
+    for (int i = 0; i < processor->getNumInputs(); i++)
     {
 
-    	String chName = processor->channels[i]->getName();
+        String chName = processor->channels[i]->getName();
 
-    	//std::cout << chName << std::endl;
+        //std::cout << chName << std::endl;
 
-    	lfpDisplay->channelInfo[i]->setName(chName);
+        lfpDisplay->channelInfo[i]->setName(chName);
 
     }
 
@@ -213,11 +213,11 @@ void LfpDisplayCanvas::comboBoxChanged(ComboBox* cb)
     }
     else if (cb == spreadSelection)
     {
-         //spread = spreads[cb->getSelectedId()-1].getFloatValue();
-         lfpDisplay->setChannelHeight(spreads[cb->getSelectedId()-1].getIntValue());
-         //lfpDisplay->resized();
-         resized();
-         //std::cout << "Setting spread to " << spreads[cb->getSelectedId()-1].getFloatValue() << std::endl;
+        //spread = spreads[cb->getSelectedId()-1].getFloatValue();
+        lfpDisplay->setChannelHeight(spreads[cb->getSelectedId()-1].getIntValue());
+        //lfpDisplay->resized();
+        resized();
+        //std::cout << "Setting spread to " << spreads[cb->getSelectedId()-1].getFloatValue() << std::endl;
     }
 
     timescale->setTimebase(timebase);
@@ -306,9 +306,9 @@ void LfpDisplayCanvas::updateScreenBuffer()
     int valuesNeeded = (int) float(nSamples) / ratio;
 
 
-    if ( screenBufferIndex + valuesNeeded > maxSamples) // crop number of samples to fit cavas width
+    if (screenBufferIndex + valuesNeeded > maxSamples)  // crop number of samples to fit cavas width
     {
-            valuesNeeded = maxSamples - screenBufferIndex;
+        valuesNeeded = maxSamples - screenBufferIndex;
     }
 
     float subSampleOffset = 0.0;
@@ -359,7 +359,7 @@ void LfpDisplayCanvas::updateScreenBuffer()
             screenBufferIndex++;
 
         }
-                
+
 
     }
     else
@@ -428,7 +428,7 @@ void LfpDisplayCanvas::paint(Graphics& g)
 
 }
 
-void LfpDisplayCanvas::refresh() 
+void LfpDisplayCanvas::refresh()
 {
     updateScreenBuffer();
 
@@ -448,6 +448,18 @@ void LfpDisplayCanvas::saveVisualizerParameters(XmlElement* xml)
     xmlNode->setAttribute("Timebase",timebaseSelection->getSelectedId());
     xmlNode->setAttribute("Spread",spreadSelection->getSelectedId());
 
+    int eventButtonState = 0;
+
+    for (int i = 0; i < 8; i++)
+    {
+    	if (lfpDisplay->eventDisplayEnabled[i])
+    	{
+    		eventButtonState += (1 << i);
+    	}
+    }
+
+    xmlNode->setAttribute("EventButtonState", eventButtonState);
+
     xmlNode->setAttribute("ScrollX",viewport->getViewPositionX());
     xmlNode->setAttribute("ScrollY",viewport->getViewPositionY());
 }
@@ -465,6 +477,15 @@ void LfpDisplayCanvas::loadVisualizerParameters(XmlElement* xml)
 
             viewport->setViewPosition(xmlNode->getIntAttribute("ScrollX"),
                                       xmlNode->getIntAttribute("ScrollY"));
+
+            int eventButtonState = xmlNode->getIntAttribute("eventButtonState");
+
+            for (int i = 0; i < 8; i++)
+            {
+            	lfpDisplay->eventDisplayEnabled[i] = (eventButtonState >> i) & 1;
+
+            	eventDisplayInterfaces[i]->checkEnabledState();
+            }
         }
     }
 
@@ -487,7 +508,7 @@ LfpTimescale::~LfpTimescale()
 void LfpTimescale::paint(Graphics& g)
 {
 
-    
+
 
     g.setFont(font);
 
@@ -630,24 +651,24 @@ void LfpDisplay::resized()
         LfpChannelDisplay* disp = channels[i];
 
         disp->setBounds(canvas->leftmargin,
-                totalHeight-disp->getChannelOverlap()/2,
-                getWidth(),
-                disp->getChannelHeight()+disp->getChannelOverlap());
+                        totalHeight-disp->getChannelOverlap()/2,
+                        getWidth(),
+                        disp->getChannelHeight()+disp->getChannelOverlap());
 
         LfpChannelDisplayInfo* info = channelInfo[i];
 
         info->setBounds(0,
-                totalHeight-disp->getChannelOverlap()/2,
-                canvas->leftmargin,
-                disp->getChannelHeight()+disp->getChannelOverlap());
+                        totalHeight-disp->getChannelOverlap()/2,
+                        canvas->leftmargin,
+                        disp->getChannelHeight()+disp->getChannelOverlap());
 
         totalHeight += disp->getChannelHeight();
 
     }
 
-    canvas->fullredraw = true; //issue full redraw 
+    canvas->fullredraw = true; //issue full redraw
 
-   // std::cout << "Total height: " << totalHeight << std::endl;
+    // std::cout << "Total height: " << totalHeight << std::endl;
 
 }
 
@@ -673,20 +694,22 @@ void LfpDisplay::refresh()
         if ((topBorder <= componentBottom && bottomBorder >= componentTop))
         {
             if (canvas->fullredraw)
-            {    
+            {
                 channels[i]->fullredraw = true;
                 channels[i]->repaint();
                 channelInfo[i]->repaint();
 
-            } else {
-                channels[i]->repaint(canvas->lastScreenBufferIndex-2, 0, (canvas->screenBufferIndex-canvas->lastScreenBufferIndex)+3, getChildComponent(i)->getHeight() ); //repaint only the updated portion
+            }
+            else
+            {
+                channels[i]->repaint(canvas->lastScreenBufferIndex-2, 0, (canvas->screenBufferIndex-canvas->lastScreenBufferIndex)+3, getChildComponent(i)->getHeight());  //repaint only the updated portion
                 // we redraw from -2 to +1 relative to the real redraw window, the -2 makes sure that the lines join nicely, and the +1 draws the vertical update line
             }
             //std::cout << i << std::endl;
         }
 
     }
-        
+
     canvas->fullredraw = false;
 }
 
@@ -726,32 +749,45 @@ int LfpDisplay::getChannelHeight()
 
 
 
- void LfpDisplay::mouseWheelMove(const MouseEvent&  e, const MouseWheelDetails&   wheel )   {
-    
+void LfpDisplay::mouseWheelMove(const MouseEvent&  e, const MouseWheelDetails&   wheel)
+{
+
     //std::cout << "Mouse wheel " <<  e.mods.isCommandDown() << "  " << wheel.deltaY << std::endl;
-    
-    if (e.mods.isCommandDown()){ // CTRL + scroll wheel -> change channel spacing 
-        // 
+
+    if (e.mods.isCommandDown())  // CTRL + scroll wheel -> change channel spacing
+    {
+        //
         // this should also scroll to keep the selected channel at a constant y!
         //
         int h = getChannelHeight();
-        if (wheel.deltaY>0){
-            setChannelHeight(h+1);            
-        } else{
+        if (wheel.deltaY>0)
+        {
+            setChannelHeight(h+1);
+        }
+        else
+        {
             if (h>5)
                 setChannelHeight(h-1);
         }
-    } else {
-        if(e.mods.isShiftDown())  {// SHIFT + scroll wheel -> change channel range
+    }
+    else
+    {
+        if (e.mods.isShiftDown())  // SHIFT + scroll wheel -> change channel range
+        {
             int h= getRange();
-            if (wheel.deltaY>0){
-                setRange(h+10);            
-            } else{
+            if (wheel.deltaY>0)
+            {
+                setRange(h+10);
+            }
+            else
+            {
                 if (h>11)
                     setRange(h-10);
             }
 
-        } else{ // just scroll
+        }
+        else    // just scroll
+        {
             //  passes the event up to the viewport so the screen scrolls
             if (viewport != nullptr && e.eventComponent == this) // passes only if it's not a listening event
                 viewport->mouseWheelMove(e.getEventRelativeTo(canvas), wheel);
@@ -759,11 +795,11 @@ int LfpDisplay::getChannelHeight()
         }
     }
 
-    canvas->fullredraw = true;//issue full redraw 
+    canvas->fullredraw = true;//issue full redraw
 
     refresh();
 
- }
+}
 
 
 void LfpDisplay::mouseDown(const MouseEvent& event)
@@ -772,17 +808,20 @@ void LfpDisplay::mouseDown(const MouseEvent& event)
     MouseEvent canvasevent = event.getEventRelativeTo(viewport);
     int y = canvasevent.getMouseDownY() + viewport->getViewPositionY(); // need to account for scrolling
 
-    int dist=0; int mindist=10000; int closest=5;
+    int dist=0;
+    int mindist=10000;
+    int closest=5;
     for (int n = 0; n < numChans; n++) // select closest instead of relying ot eventComponent
     {
         channels[n]->deselect();
-        
+
         int cpos=(channels[n]->getY() + (channels[n]->getHeight()/2));
-        dist=int(abs( y - cpos )); 
-    
+        dist=int(abs(y - cpos));
+
         //std::cout << "Mouse down at " << y << " pos is "<< cpos << "n:" << n << "  dist " << dist << std::endl;
 
-        if (dist<mindist) {
+        if (dist<mindist)
+        {
             mindist=dist-1;
             closest=n;
         }
@@ -793,7 +832,7 @@ void LfpDisplay::mouseDown(const MouseEvent& event)
 
     channels[closest]->select();
 
-    canvas->fullredraw = true;//issue full redraw 
+    canvas->fullredraw = true;//issue full redraw
 
     refresh();
 
@@ -805,9 +844,9 @@ bool LfpDisplay::setEventDisplayState(int ch, bool state)
     eventDisplayEnabled[ch] = state;
     return eventDisplayEnabled[ch];
 }
-    
 
-bool LfpDisplay::getEventDisplayState(int ch) 
+
+bool LfpDisplay::getEventDisplayState(int ch)
 {
     return eventDisplayEnabled[ch];
 }
@@ -820,7 +859,7 @@ LfpChannelDisplay::LfpChannelDisplay(LfpDisplayCanvas* c, LfpDisplay* d, int cha
 {
 
 
-	name = String(channelNumber+1); // default is to make the channelNumber the name
+    name = String(channelNumber+1); // default is to make the channelNumber the name
 
 
     channelHeightFloat = (float) channelHeight;
@@ -847,7 +886,7 @@ void LfpChannelDisplay::paint(Graphics& g)
 
 
 
-    //g.setColour(Colours::red); // draw oldest drawn sample position 
+    //g.setColour(Colours::red); // draw oldest drawn sample position
     //g.drawLine(canvas->lastScreenBufferIndex, 0, canvas->lastScreenBufferIndex, getHeight()-channelOverlap);
 
     int center = getHeight()/2;
@@ -871,13 +910,13 @@ void LfpChannelDisplay::paint(Graphics& g)
     g.drawLine(0, getHeight()/2, getWidth(), getHeight()/2);
 
     int stepSize = 1;
-    int from = 0; // for vertical line drawing in the LFP data 
+    int from = 0; // for vertical line drawing in the LFP data
     int to = 0;
 
     //for (int i = 0; i < getWidth()-stepSize; i += stepSize) // redraw entire display
     int ifrom = canvas->lastScreenBufferIndex - 3; // need to start drawing a bit before the actual redraw windowfor the interpolated line to join correctly
-    
-    if (ifrom < 0) 
+
+    if (ifrom < 0)
         ifrom = 0;
 
     int ito = canvas->screenBufferIndex - 1;
@@ -893,28 +932,30 @@ void LfpChannelDisplay::paint(Graphics& g)
     {
 
         // draw event markers
-        int rawEventState = canvas->getYCoord(canvas->getNumChannels(), i);// get last channel+1 in buffer (represents events) 
+        int rawEventState = canvas->getYCoord(canvas->getNumChannels(), i);// get last channel+1 in buffer (represents events)
         for (int ev_ch = 0; ev_ch < 8 ; ev_ch++) // for all event channels
         {
-            if (display->getEventDisplayState(ev_ch)){ // check if plotting for this channel is enabled
-                if ( rawEventState & (1 << ev_ch)){  // events are  representet by a bit code, so we have to extract the individual bits with a mask
+            if (display->getEventDisplayState(ev_ch))  // check if plotting for this channel is enabled
+            {
+                if (rawEventState & (1 << ev_ch))    // events are  representet by a bit code, so we have to extract the individual bits with a mask
+                {
                     g.setColour(display->channelColours[ev_ch*2]); // get color from lfp color scheme
-                    g.setOpacity(0.25f);
+                    g.setOpacity(0.35f);
                     g.drawLine(i, center-channelHeight/2 , i, center+channelHeight/2);
                 }
             }
         }
 
-        //std::cout << "e " << canvas->getYCoord(canvas->getNumChannels()-1, i) << std::endl;          
-        
+        //std::cout << "e " << canvas->getYCoord(canvas->getNumChannels()-1, i) << std::endl;
+
         g.setColour(lineColour);
         g.setOpacity(1);
 
-       // drawLine makes for ok anti-aliased plots, but is pretty slow
+        // drawLine makes for ok anti-aliased plots, but is pretty slow
         g.drawLine(i,
-                  (canvas->getYCoord(chan, i)/range*channelHeightFloat)+getHeight()/2,
+                   (canvas->getYCoord(chan, i)/range*channelHeightFloat)+getHeight()/2,
                    i+stepSize,
-                    (canvas->getYCoord(chan, i+stepSize)/range*channelHeightFloat)+getHeight()/2);
+                   (canvas->getYCoord(chan, i+stepSize)/range*channelHeightFloat)+getHeight()/2);
 
         if (false) // switched back to line drawing now that we only draw partial updates
         {
@@ -923,38 +964,46 @@ void LfpChannelDisplay::paint(Graphics& g)
             double a = (canvas->getYCoord(chan, i)/range*channelHeightFloat)+getHeight()/2;
             double b = (canvas->getYCoord(chan, i+stepSize)/range*channelHeightFloat)+getHeight()/2;
 
-            if (a<b){
-                 from = (a);
-                 to = (b);
-            } else {
-                 from = (b);
-                 to = (a);
+            if (a<b)
+            {
+                from = (a);
+                to = (b);
+            }
+            else
+            {
+                from = (b);
+                to = (a);
             }
-            
-            if ((to-from) < 40){ // if there is too much vertical range in one pixel, don't draw the full line for speed reasons 
+
+            if ((to-from) < 40)  // if there is too much vertical range in one pixel, don't draw the full line for speed reasons
+            {
                 for (int j = from; j <= to; j += 1)
                 {
                     g.setPixel(i,j);
                 }
-            } else if ((to-from) < 100){
+            }
+            else if ((to-from) < 100)
+            {
                 for (int j = from; j <= to; j += 2)
                 {
                     g.setPixel(i,j);
                 }
-            } else {
+            }
+            else
+            {
                 g.setPixel(i,to);
                 g.setPixel(i,from);
             }
 
         }
-        
+
     }
 
- // g.setColour(lineColour.withAlpha(0.7f)); // alpha on seems to decrease draw speed
-   // g.setFont(channelFont);
-  //  g.setFont(channelHeightFloat*0.6);
+    // g.setColour(lineColour.withAlpha(0.7f)); // alpha on seems to decrease draw speed
+    // g.setFont(channelFont);
+    //  g.setFont(channelHeightFloat*0.6);
 
-   // g.drawText(String(chan+1), 10, center-channelHeight/2, 200, channelHeight, Justification::left, false);
+    // g.drawText(String(chan+1), 10, center-channelHeight/2, 200, channelHeight, Justification::left, false);
 
 
 }
@@ -997,8 +1046,8 @@ void LfpChannelDisplay::setChannelHeight(int c)
 {
     channelHeight = c;
     channelHeightFloat = (float) channelHeight;
-    //channelOverlap = channelHeight / 2; //clips data too early, 
-    channelOverlap = channelHeight *5;   
+    //channelOverlap = channelHeight / 2; //clips data too early,
+    channelOverlap = channelHeight *5;
 }
 
 int LfpChannelDisplay::getChannelHeight()
@@ -1020,7 +1069,7 @@ int LfpChannelDisplay::getChannelOverlap()
 
 void LfpChannelDisplay::setName(String name_)
 {
-	name = name_;
+    name = name_;
 }
 
 // -------------------------------
@@ -1046,15 +1095,15 @@ void LfpChannelDisplayInfo::paint(Graphics& g)
 
 }
 
- 
+
 
 // Event display Options --------------------------------------------------------------------
 
-eventDisplayInterface::eventDisplayInterface(LfpDisplay* display_, LfpDisplayCanvas* canvas_, int chNum):
+EventDisplayInterface::EventDisplayInterface(LfpDisplay* display_, LfpDisplayCanvas* canvas_, int chNum):
     isEnabled(true), display(display_), canvas(canvas_)
 {
 
-    channelNumber=chNum;
+    channelNumber = chNum;
 
     chButton = new UtilityButton(String(channelNumber+1), Font("Small Text", 13, Font::plain));
     chButton->setRadius(5.0f);
@@ -1070,38 +1119,42 @@ eventDisplayInterface::eventDisplayInterface(LfpDisplay* display_, LfpDisplayCan
 
 }
 
-eventDisplayInterface::~eventDisplayInterface()
+EventDisplayInterface::~EventDisplayInterface()
 {
 
 }
 
-void eventDisplayInterface::checkEnabledState()
+void EventDisplayInterface::checkEnabledState()
 {
     isEnabled = display->getEventDisplayState(channelNumber);
-    
+
     //repaint();
 }
 
-void eventDisplayInterface::buttonClicked(Button* button)
+void EventDisplayInterface::buttonClicked(Button* button)
 {
-  checkEnabledState();
-  if (isEnabled){
-    display->setEventDisplayState(channelNumber, false);
-  } else {
-    display->setEventDisplayState(channelNumber, true);
-  }
+    checkEnabledState();
+    if (isEnabled)
+    {
+        display->setEventDisplayState(channelNumber, false);
+    }
+    else
+    {
+        display->setEventDisplayState(channelNumber, true);
+    }
 
-  repaint();
+    repaint();
 
 }
 
 
-void eventDisplayInterface::paint(Graphics& g)
+void EventDisplayInterface::paint(Graphics& g)
 {
 
     checkEnabledState();
 
-    if (isEnabled){
+    if (isEnabled)
+    {
         g.setColour(display->channelColours[channelNumber*2]);
         g.fillRoundedRectangle(2,2,18,18,5.0f);
     }
diff --git a/Source/Processors/Visualization/LfpDisplayCanvas.h b/Source/Processors/Visualization/LfpDisplayCanvas.h
index 59e538689a0563fefde393e095fbbb31f0c9e978..696c660a3bc946d30ab6d3363512b30f3c0619e0 100755
--- a/Source/Processors/Visualization/LfpDisplayCanvas.h
+++ b/Source/Processors/Visualization/LfpDisplayCanvas.h
@@ -33,7 +33,7 @@ class LfpTimescale;
 class LfpDisplay;
 class LfpChannelDisplay;
 class LfpChannelDisplayInfo;
-class eventDisplayInterface;
+class EventDisplayInterface;
 
 /**
 
@@ -45,7 +45,7 @@ class eventDisplayInterface;
 
 class LfpDisplayCanvas : public Visualizer,
     public ComboBox::Listener
-    
+
 {
 public:
     LfpDisplayCanvas(LfpDisplayNode* n);
@@ -100,9 +100,6 @@ private:
     static const int MAX_N_SAMP = 5000; // maximum display size in pixels
     //float waves[MAX_N_CHAN][MAX_N_SAMP*2]; // we need an x and y point for each sample
 
-    
-
-
     LfpDisplayNode* processor;
     AudioSampleBuffer* displayBuffer;
     AudioSampleBuffer* screenBuffer;
@@ -120,8 +117,7 @@ private:
     StringArray timebases;
     StringArray spreads; // option for vertical spacing between channels
 
-    OwnedArray<eventDisplayInterface> eventDisplayInterfaces;
-
+    OwnedArray<EventDisplayInterface> eventDisplayInterfaces;
 
     void refreshScreenBuffer();
     void updateScreenBuffer();
@@ -133,7 +129,6 @@ private:
 
     int nChans;
 
-
     JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(LfpDisplayCanvas);
 
 };
@@ -168,9 +163,9 @@ public:
 
     void setNumChannels(int numChannels);
     int getNumChannels();
-    
+
     int getTotalHeight();
-    
+
     void paint(Graphics& g);
 
     void refresh();
@@ -178,9 +173,9 @@ public:
     void resized();
 
     void mouseDown(const MouseEvent& event);
-    void mouseWheelMove(const MouseEvent&  event, const MouseWheelDetails&   wheel ) ;
+    void mouseWheelMove(const MouseEvent&  event, const MouseWheelDetails&   wheel) ;
+
 
-    
     void setRange(float range);
     int getRange();
 
@@ -197,6 +192,7 @@ public:
     Array<LfpChannelDisplay*> channels;
     Array<LfpChannelDisplayInfo*> channelInfo;
 
+    bool eventDisplayEnabled[8];
 
 private:
     int numChans;
@@ -204,11 +200,7 @@ private:
     int totalHeight;
 
     LfpDisplayCanvas* canvas;
-    Viewport* viewport;
-
-    bool eventDisplayEnabled[8];
-
-
+    Viewport* viewport;    
 
     float range;
 
@@ -272,12 +264,12 @@ public:
 
 };
 
-class eventDisplayInterface : public Component,
+class EventDisplayInterface : public Component,
     public Button::Listener
 {
 public:
-    eventDisplayInterface(LfpDisplay*, LfpDisplayCanvas*, int chNum);
-    ~eventDisplayInterface();
+    EventDisplayInterface(LfpDisplay*, LfpDisplayCanvas*, int chNum);
+    ~EventDisplayInterface();
 
     void paint(Graphics& g);
 
@@ -285,11 +277,11 @@ public:
 
     void checkEnabledState();
 
+    bool isEnabled;
+
 private:
 
     int channelNumber;
-    
-    bool isEnabled;
 
     LfpDisplay* display;
     LfpDisplayCanvas* canvas;
diff --git a/Source/Processors/Visualization/SpikeDisplayCanvas.cpp b/Source/Processors/Visualization/SpikeDisplayCanvas.cpp
index d84ac733f9c6093ab120984996673195899484c1..b34633311083515f419675b61bfd7721a6137883 100755
--- a/Source/Processors/Visualization/SpikeDisplayCanvas.cpp
+++ b/Source/Processors/Visualization/SpikeDisplayCanvas.cpp
@@ -20,7 +20,7 @@
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 */
- 
+
 #include "SpikeDisplayCanvas.h"
 #include "../RecordNode.h"
 
@@ -168,7 +168,7 @@ bool SpikeDisplayCanvas::keyPressed(const KeyPress& key)
     if (key.isKeyCode(c.getKeyCode())) // C
     {
         spikeDisplay->clear();
-        
+
         std::cout << "Clearing display" << std::endl;
         return true;
     }
@@ -205,20 +205,20 @@ SpikeDisplay::~SpikeDisplay()
 
 void SpikeDisplay::clear()
 {
-   if (spikePlots.size() > 0)
-   {
+    if (spikePlots.size() > 0)
+    {
         for (int i = 0; i < spikePlots.size(); i++)
         {
             spikePlots[i]->clear();
         }
-   }
-        
+    }
+
 }
 
 void SpikeDisplay::removePlots()
 {
-   spikePlots.clear();
-        
+    spikePlots.clear();
+
 }
 
 void SpikeDisplay::addSpikePlot(int numChannels, int electrodeNum, String name_)
@@ -333,9 +333,9 @@ void SpikeDisplay::resized()
 
         }
 
-        totalHeight = (int) maxHeight + 50; 
+        totalHeight = (int) maxHeight + 50;
 
-       // std::cout << "New height = " << totalHeight << std::endl;
+        // std::cout << "New height = " << totalHeight << std::endl;
 
         setBounds(0, 0, getWidth(), totalHeight);
     }
@@ -356,7 +356,7 @@ void SpikeDisplay::plotSpike(const SpikeObject& spike, int electrodeNum)
 // ----------------------------------------------------------------
 
 SpikePlot::SpikePlot(SpikeDisplayCanvas* sdc, int elecNum, int p, String name_) :
-     canvas(sdc), isSelected(false), electrodeNumber(elecNum),  plotType(p),
+    canvas(sdc), isSelected(false), electrodeNumber(elecNum),  plotType(p),
     limitsChanged(true), name(name_), isRecording(false)
 
 {
@@ -449,7 +449,7 @@ void SpikePlot::processSpikeObject(const SpikeObject& s)
     {
         aboveThreshold = aboveThreshold | wAxes[i]->checkThreshold(s);
     }
-        
+
     if (aboveThreshold)
     {
         for (int i = 0; i < nWaveAx; i++)
@@ -458,7 +458,7 @@ void SpikePlot::processSpikeObject(const SpikeObject& s)
         for (int i = 0; i < nProjAx; i++)
             pAxes[i]->updateSpikeData(s);
     }
-    
+
 
     // then record it!
     if (recordNode->isRecording)
@@ -470,17 +470,19 @@ void SpikePlot::processSpikeObject(const SpikeObject& s)
 
             isRecording = true;
             //std::cout << "Start recording spikes." << std::endl;
-       
+
         }
 
         if (aboveThreshold)
         {
-             // write spike to disk
+            // write spike to disk
             writeSpike(s);
         }
 
-    } else {
-        
+    }
+    else
+    {
+
         if (isRecording)
         {
             // close file
@@ -500,7 +502,7 @@ void SpikePlot::openFile()
     filename = dataDirectory.getFullPathName();
     filename += File::separator;
     filename += name.removeCharacters(" ");
-    filename += ".spikes"; 
+    filename += ".spikes";
 
     std::cout << "OPENING FILE: " << filename << std::endl;
 
@@ -515,7 +517,9 @@ void SpikePlot::openFile()
 
         fwrite(header.toUTF8(), 1, header.getNumBytesAsUTF8(), file);
 
-    } else {
+    }
+    else
+    {
 
         // append it
         file = fopen(filename.toUTF8(), "ab");
@@ -542,7 +546,22 @@ void SpikePlot::writeSpike(const SpikeObject& s)
 
     packSpike(&s, spikeBuffer, MAX_SPIKE_BUFFER_LEN);
 
-    fwrite(spikeBuffer, 1, MAX_SPIKE_BUFFER_LEN, file);
+    int totalBytes = s.nSamples * s.nChannels * 2 + // account for samples
+                     s.nChannels * 4 +            // acount for threshold and gain
+                     15;                        // 15 bytes in every SpikeObject
+
+
+    // format:
+    // 1 byte of event type (always = 4 for spikes)
+    // 8 bytes for 64-bit timestamp
+    // 2 bytes for 16-bit electrode ID
+    // 2 bytes for 16-bit number of channels (n)
+    // 2 bytes for 16-bit number of samples (m)
+    // 2*n*m bytes for 16-bit samples
+    // 2*n bytes for 16-bit gains
+    // 2*n bytes for 16-bit thresholds
+
+    fwrite(spikeBuffer, 1, totalBytes, file);
 
 
 }
@@ -555,7 +574,7 @@ String SpikePlot::generateHeader()
     header += String(HEADER_SIZE);
     header += ";\n";
 
-    header += "header.description = 'Spike data...live it up!'; \n";
+    header += "header.description = 'Each record contains 1 uint8 eventType, 1 uint64 timestamp, 1 uint16 electrodeID, 1 uint16 numChannels (n), 1 uint16 numSamples (m), n*m uint16 samples, n uint16 channelGains, and n uint16 thresholds'; \n";
 
     header += "header.date_created = '";
     header += recordNode->generateDateString();
@@ -566,7 +585,7 @@ String SpikePlot::generateHeader()
     header += "';\n";
 
     header += "header.num_channels = ";
-    header += nChannels; 
+    header += nChannels;
     header += ";\n";
 
     header += "header.sampleRate = ";
@@ -651,8 +670,8 @@ void SpikePlot::resized()
     for (int i = 0; i < nWaveAx; i++)
     {
         wAxes[i]->setBounds(5 + (i % nWaveCols) * axesWidth/nWaveCols, 20 + (i/nWaveCols) * axesHeight, axesWidth/nWaveCols, axesHeight);
-        rangeButtons[i]->setBounds(8 + (i % nWaveCols) * axesWidth/nWaveCols, 
-                                   20 + (i/nWaveCols) * axesHeight + axesHeight - 18, 
+        rangeButtons[i]->setBounds(8 + (i % nWaveCols) * axesWidth/nWaveCols,
+                                   20 + (i/nWaveCols) * axesHeight + axesHeight - 18,
                                    25, 15);
     }
 
@@ -673,15 +692,17 @@ void SpikePlot::buttonClicked(Button* button)
     {
         ranges.set(index, 500.0f);
         label = "500";
-    } else if (ranges[index] == 500.0f)
+    }
+    else if (ranges[index] == 500.0f)
     {
         ranges.set(index, 100.0f);
         label = "100";
-    } else if  (ranges[index] == 100.0f)
+    }
+    else if (ranges[index] == 100.0f)
     {
         ranges.set(index, 250.0f);
         label = "250";
-    } 
+    }
 
     buttonThatWasClicked->setLabel(label);
 
@@ -694,7 +715,7 @@ void SpikePlot::setLimitsOnAxes()
     //std::cout<<"SpikePlot::setLimitsOnAxes()"<<std::endl;
 
     for (int i = 0; i < nWaveAx; i++)
-         wAxes[i]->setRange(ranges[i]);
+        wAxes[i]->setRange(ranges[i]);
 
     // Each projection sets its limits using the limits of the two waveform dims it represents.
     // Convert projection number to indices, and then set the limits using those indices
@@ -754,7 +775,7 @@ void SpikePlot::clear()
 // --------------------------------------------------
 
 
-WaveAxes::WaveAxes(int channel) : GenericAxes(channel), drawGrid(true), 
+WaveAxes::WaveAxes(int channel) : GenericAxes(channel), drawGrid(true),
     bufferSize(10), spikeIndex(0), thresholdLevel(0.0f), range(250.0f),
     isOverThresholdSlider(false), isDraggingThresholdSlider(false)
 {
@@ -769,7 +790,7 @@ WaveAxes::WaveAxes(int channel) : GenericAxes(channel), drawGrid(true),
     {
         SpikeObject so;
         generateEmptySpike(&so, 4);
-        
+
         spikeBuffer.add(so);
     }
 }
@@ -804,7 +825,7 @@ void WaveAxes::paint(Graphics& g)
     {
         return;
     }
-   
+
 
     for (int spikeNum = 0; spikeNum < bufferSize; spikeNum++)
     {
@@ -813,15 +834,15 @@ void WaveAxes::paint(Graphics& g)
         {
             g.setColour(Colours::grey);
             plotSpike(spikeBuffer[spikeNum], g);
-         }
+        }
 
     }
 
     g.setColour(Colours::white);
     plotSpike(spikeBuffer[spikeIndex], g);
-    
 
-    
+
+
 
 }
 
@@ -832,7 +853,7 @@ void WaveAxes::plotSpike(const SpikeObject& s, Graphics& g)
 
     //compute the spatial width for each waveform sample
     float dx = getWidth()/float(spikeBuffer[0].nSamples);
-    
+
     // type corresponds to channel so we need to calculate the starting
     // sample based upon which channel is getting plotted
     int sampIdx = 40*type; //spikeBuffer[0].nSamples * type; //
@@ -841,22 +862,22 @@ void WaveAxes::plotSpike(const SpikeObject& s, Graphics& g)
 
     float x = 0.0f;
 
-     for (int i = 0; i < s.nSamples-1; i++)
+    for (int i = 0; i < s.nSamples-1; i++)
     {
         //std::cout << s.data[sampIdx] << std::endl;
 
         if (*s.gain != 0)
         {
             float s1 = h/2 + float(s.data[sampIdx]-32768)/float(*s.gain)*1000.0f / range * h;
-            float s2 =  h/2 + float(s.data[sampIdx+1]-32768)/float(*s.gain)*1000.0f / range * h; 
+            float s2 =  h/2 + float(s.data[sampIdx+1]-32768)/float(*s.gain)*1000.0f / range * h;
 
-             g.drawLine(x, 
-                 s1, 
-                 x+dx, 
-                 s2);
+            g.drawLine(x,
+                       s1,
+                       x+dx,
+                       s2);
         }
 
-        
+
 
         sampIdx += dSamples;
         x += dx;
@@ -890,7 +911,7 @@ void WaveAxes::drawWaveformGrid(Graphics& g)
         else
             g.drawLine(0,h/2 + y/range*h, w, h/2+ y/range*h);
     }
-   
+
 }
 
 bool WaveAxes::updateSpikeData(const SpikeObject& s)
@@ -906,18 +927,18 @@ bool WaveAxes::updateSpikeData(const SpikeObject& s)
     spikeIndex %= bufferSize;
 
     spikeBuffer.set(spikeIndex, newSpike);
-
-    return true;
     
+    return true;
+
 }
 
 bool WaveAxes::checkThreshold(const SpikeObject& s)
 {
     int sampIdx = 40*type;
 
-     for (int i = 0; i < s.nSamples-1; i++)
+    for (int i = 0; i < s.nSamples-1; i++)
     {
-        
+
         if (float(s.data[sampIdx]-32768)/float(*s.gain)*1000.0f > thresholdLevel)
         {
             return true;
@@ -940,7 +961,7 @@ void WaveAxes::clear()
     {
         SpikeObject so;
         generateEmptySpike(&so, 4);
-        
+
         spikeBuffer.add(so);
     }
 
@@ -950,35 +971,37 @@ void WaveAxes::clear()
 void WaveAxes::mouseMove(const MouseEvent& event)
 {
 
-   // Point<int> pos = event.getPosition();
+    // Point<int> pos = event.getPosition();
 
     float y = event.y;
 
     float h = getHeight()*(0.5f - thresholdLevel/range);
 
-   // std::cout << y << " " << h << std::endl;
+    // std::cout << y << " " << h << std::endl;
 
     if (y > h - 10.0f && y < h + 10.0f && !isOverThresholdSlider)
     {
-        thresholdColour = Colours::yellow; 
+        thresholdColour = Colours::yellow;
+
+        //  std::cout << "Yes." << std::endl;
 
-      //  std::cout << "Yes." << std::endl;
-        
         repaint();
 
         isOverThresholdSlider = true;
 
-       // cursorType = MouseCursor::DraggingHandCursor;
+        // cursorType = MouseCursor::DraggingHandCursor;
 
-    } else if ((y < h - 10.0f || y > h + 10.0f) && isOverThresholdSlider){
+    }
+    else if ((y < h - 10.0f || y > h + 10.0f) && isOverThresholdSlider)
+    {
 
         thresholdColour = Colours::red;
         repaint();
 
         isOverThresholdSlider = false;
 
-     //   cursorType = MouseCursor::NormalCursor;
-        
+        //   cursorType = MouseCursor::NormalCursor;
+
     }
 
 
@@ -1023,9 +1046,9 @@ void WaveAxes::mouseDrag(const MouseEvent& event)
 void WaveAxes::mouseExit(const MouseEvent& event)
 {
     if (isOverThresholdSlider)
-     {
+    {
         isOverThresholdSlider = false;
-        thresholdColour = Colours::red; 
+        thresholdColour = Colours::red;
         repaint();
     }
 }
@@ -1033,7 +1056,7 @@ void WaveAxes::mouseExit(const MouseEvent& event)
 // --------------------------------------------------
 
 ProjectionAxes::ProjectionAxes(int projectionNum) : GenericAxes(projectionNum), imageDim(500),
-                                                    rangeX(250), rangeY(250)
+    rangeX(250), rangeY(250)
 {
     projectionImage = Image(Image::RGB, imageDim, imageDim, true);
 
@@ -1041,7 +1064,7 @@ ProjectionAxes::ProjectionAxes(int projectionNum) : GenericAxes(projectionNum),
     //Graphics g(projectionImage);
     //g.setColour(Colours::red);
     //g.fillEllipse(20, 20, 300, 200);
-    
+
     n2ProjIdx(projectionNum, &ampDim1, &ampDim2);
 
 
@@ -1081,13 +1104,14 @@ bool ProjectionAxes::updateSpikeData(const SpikeObject& s)
 
     updateProjectionImage(s.data[idx1], s.data[idx2], *s.gain);
 
+    return true;
 }
 
 void ProjectionAxes::updateProjectionImage(uint16_t x, uint16_t y, uint16_t gain)
 {
     Graphics g(projectionImage);
 
-   // h/2 + float(s.data[sampIdx]-32768)/float(*s.gain)*1000.0f / range * h;
+    // h/2 + float(s.data[sampIdx]-32768)/float(*s.gain)*1000.0f / range * h;
 
     if (gain != 0)
     {
@@ -1095,7 +1119,7 @@ void ProjectionAxes::updateProjectionImage(uint16_t x, uint16_t y, uint16_t gain
         float yf = float(imageDim) - float(y-32768)/float(gain)*1000.0f; // in microvolts
 
         g.setColour(Colours::white);
-        g.fillEllipse(xf,yf,2.0f,2.0f); 
+        g.fillEllipse(xf,yf,2.0f,2.0f);
     }
 
 }
@@ -1126,7 +1150,7 @@ void ProjectionAxes::calcWaveformPeakIdx(const SpikeObject& s, int d1, int d2, i
 void ProjectionAxes::clear()
 {
     projectionImage.clear(Rectangle<int>(0, 0, projectionImage.getWidth(), projectionImage.getHeight()),
-                         Colours::black);
+                          Colours::black);
 
     repaint();
 }
@@ -1203,6 +1227,7 @@ bool GenericAxes::updateSpikeData(const SpikeObject& newSpike)
     }
 
     s = newSpike;
+    return true;
 }
 
 void GenericAxes::setYLims(double ymin, double ymax)
diff --git a/Source/Processors/Visualization/SpikeDisplayCanvas.h b/Source/Processors/Visualization/SpikeDisplayCanvas.h
index 1b3f835aaf99b04c84cc1f747e8617425bf762c2..ba91a18ef61dffa5f06da5fdaccbb1fa2ce3694e 100755
--- a/Source/Processors/Visualization/SpikeDisplayCanvas.h
+++ b/Source/Processors/Visualization/SpikeDisplayCanvas.h
@@ -100,7 +100,7 @@ public:
     SpikeDisplayNode* processor;
 
 private:
-    
+
     MidiBuffer* spikeBuffer;
 
     ScopedPointer<SpikeDisplay> spikeDisplay;
@@ -315,7 +315,10 @@ public:
     void mouseDrag(const MouseEvent& event);
 
     void setRange(float);
-    float getRange() {return range;}
+    float getRange()
+    {
+        return range;
+    }
 
     //MouseCursor getMouseCursor();
 
@@ -333,7 +336,7 @@ private:
 
     void drawThresholdSlider(Graphics& g);
 
-    
+
 
     Font font;
 
diff --git a/Source/Processors/Visualization/SpikeObject.cpp b/Source/Processors/Visualization/SpikeObject.cpp
index bb7ce020b4f4ddc6ec1e19f0eb6db375f2c857d3..e6250ce5e785dd12f5ecf00aa5fa33bc3eb5b0ab 100755
--- a/Source/Processors/Visualization/SpikeObject.cpp
+++ b/Source/Processors/Visualization/SpikeObject.cpp
@@ -60,11 +60,11 @@ int packSpike(const SpikeObject* s, uint8_t* buffer, int bufferSize)
 
     if (idx >= MAX_SPIKE_BUFFER_LEN)
     {
-        std::cout << "Spike is larger than it should be. Size was: " << idx 
+        std::cout << "Spike is larger than it should be. Size was: " << idx
                   << " Max Size is: " << MAX_SPIKE_BUFFER_LEN << std::endl;
 
     }
-    
+
     makeBufferValid(buffer, bufferSize);
 
     return idx;
@@ -74,7 +74,7 @@ int packSpike(const SpikeObject* s, uint8_t* buffer, int bufferSize)
 // Simple method for deserializing a string of bytes into a Spike object
 bool unpackSpike(SpikeObject* s, const uint8_t* buffer, int bufferSize)
 {
-   // if (!isBufferValid(buffer, bufferSize))
+    // if (!isBufferValid(buffer, bufferSize))
     // 	return false;
 
     int idx = 0;
@@ -103,8 +103,8 @@ bool unpackSpike(SpikeObject* s, const uint8_t* buffer, int bufferSize)
     memcpy(&(s->threshold), buffer+idx, s->nChannels *2);
     idx += s->nChannels * 2;
 
-   // if (idx >= bufferSize)
-   // 		std::cout<<"Buffer Overrun! More data extracted than was given!"<<std::endl;
+    // if (idx >= bufferSize)
+    // 		std::cout<<"Buffer Overrun! More data extracted than was given!"<<std::endl;
 
     return true;
 
diff --git a/Source/UI/ControlPanel.cpp b/Source/UI/ControlPanel.cpp
index ac5319f987ed9f643e095d85cab9be510255c401..65ffb46aa0b6e2baff110da21a59cd6962a77ee0 100755
--- a/Source/UI/ControlPanel.cpp
+++ b/Source/UI/ControlPanel.cpp
@@ -750,7 +750,9 @@ String ControlPanel::getTextToAppend()
     if (t.length() > 0)
     {
         return "_" + t;
-    } else {
+    }
+    else
+    {
         return t;
     }
 }
@@ -762,7 +764,9 @@ String ControlPanel::getTextToPrepend()
     if (t.length() > 0)
     {
         return t + "_";
-    } else {
+    }
+    else
+    {
         return t;
     }
 }
@@ -787,10 +791,10 @@ void ControlPanel::loadStateFromXml(XmlElement* xml)
 {
 
     forEachXmlChildElement(*xml, xmlNode)
-     {
+    {
         if (xmlNode->hasTagName("CONTROLPANEL"))
         {
-            
+
             appendText->setText(xmlNode->getStringAttribute("appendText", ""), dontSendNotification);
             prependText->setText(xmlNode->getStringAttribute("prependText", ""), dontSendNotification);
 
diff --git a/Source/UI/EditorViewport.cpp b/Source/UI/EditorViewport.cpp
index b36413d395ba3900aab94dab21eb61a647b105c0..d9f42be332c29acde4788210d1e45f2851fa6a10 100755
--- a/Source/UI/EditorViewport.cpp
+++ b/Source/UI/EditorViewport.cpp
@@ -168,7 +168,7 @@ void EditorViewport::itemDragMove(const SourceDetails& dragSourceDetails)
 {
 
     int x = dragSourceDetails.localPosition.getX();
-   // int y = dragSourceDetails.localPosition.getY();
+    // int y = dragSourceDetails.localPosition.getY();
 
     if (canEdit)
     {
@@ -1393,7 +1393,8 @@ const String EditorViewport::loadState(File fileToLoad)
     return error;
 }
 /* Set parameters based on XML.*/
-void EditorViewport::setParametersByXML(GenericProcessor* targetProcessor, XmlElement* processorXML){
+void EditorViewport::setParametersByXML(GenericProcessor* targetProcessor, XmlElement* processorXML)
+{
     // Should probably do some error checking to make sure XML is valid, depending on how it treats errors (will likely just not update parameters, but error message could be nice.)
     int numberParameters=targetProcessor->getNumParameters();
     // Ditto channels. Not sure how to handle different channel sizes when variable sources (file reader etc. change). Maybe I should check number of channels vs source, but that requires hardcoding when source matters.
@@ -1408,21 +1409,25 @@ void EditorViewport::setParametersByXML(GenericProcessor* targetProcessor, XmlEl
     String parameterValue;
     float parameterFloat;
     //float testGrab;
-    
 
-    forEachXmlChildElementWithTagName(*processorXML, channelXML, "CHANNEL"){
+
+    forEachXmlChildElementWithTagName(*processorXML, channelXML, "CHANNEL")
+    {
         currentChannel=channelXML->getIntAttribute("name");
-        
-       // std::cout <<"currentChannel:"<< currentChannel  << std::endl;
+
+        // std::cout <<"currentChannel:"<< currentChannel  << std::endl;
         // Sets channel to change parameter on
         targetProcessor->setCurrentChannel(currentChannel-1);
 
-        forEachXmlChildElement(*channelXML, parameterXML){
-        
-            for (int j = 0; j < numberParameters; ++j){
+        forEachXmlChildElement(*channelXML, parameterXML)
+        {
+
+            for (int j = 0; j < numberParameters; ++j)
+            {
                 parameterNameForXML=targetProcessor->getParameterName(j);
 
-                if (parameterXML->getStringAttribute("name")==parameterNameForXML){
+                if (parameterXML->getStringAttribute("name")==parameterNameForXML)
+                {
                     parameterValue=parameterXML->getAllSubText();
                     parameterFloat=parameterValue.getFloatValue();
                     targetProcessor->setParameter(j, parameterFloat);
@@ -1431,7 +1436,7 @@ void EditorViewport::setParametersByXML(GenericProcessor* targetProcessor, XmlEl
                 }
 
             }
-            
+
 
         }
     }
diff --git a/Source/UI/ProcessorList.cpp b/Source/UI/ProcessorList.cpp
index 4cf9a433c7d5988ab5c2f0088e535898ae24c752..2b0986e5929b5c03e059c447ccf66f7f9890dea2 100755
--- a/Source/UI/ProcessorList.cpp
+++ b/Source/UI/ProcessorList.cpp
@@ -44,30 +44,16 @@ ProcessorList::ProcessorList()
     listFontLight = Font("Default Light", 25, Font::plain);
     listFontPlain = Font("Default", 20, Font::plain);
 
-    // MemoryInputStream mis1(BinaryData::cpmonolightserialized,
-    //                        BinaryData::cpmonolightserializedSize,
-    //                        false);
-    // Typeface::Ptr tp1 = new CustomTypeface(mis1);
-    // listFontLight = Font(tp1);
-    // listFontLight.setHeight(25);
-
-    // MemoryInputStream mis2(BinaryData::cpmonoplainserialized,
-    //                        BinaryData::cpmonoplainserializedSize,
-    //                        false);
-    // Typeface::Ptr tp2 = new CustomTypeface(mis2);
-    // listFontPlain = Font(tp2);
-    // listFontPlain.setHeight(20);
-
     setColour(PROCESSOR_COLOR, Colour(59, 59, 59));
-    setColour(FILTER_COLOR, Colour(41, 76, 158));//Colour(255, 89, 0));
-    setColour(SINK_COLOR, Colour(93, 125, 199));//Colour(255, 149, 0));
-    setColour(SOURCE_COLOR, Colour(48, 67, 112)); //Colour(255, 0, 0));
-    setColour(UTILITY_COLOR, Colour(90, 80, 80));
+    setColour(FILTER_COLOR, Colour(0, 174, 239));
+    setColour(SINK_COLOR, Colour(0, 166, 81));
+    setColour(SOURCE_COLOR, Colour(241, 90, 41));
+    setColour(UTILITY_COLOR, Colour(147, 149, 152));
 
     ProcessorListItem* sources = new ProcessorListItem("Sources");
     sources->addSubItem(new ProcessorListItem("RHA2000-EVAL"));
     //sources->addSubItem(new ProcessorListItem("Signal Generator"));
-    sources->addSubItem(new ProcessorListItem("Custom FPGA"));
+    //sources->addSubItem(new ProcessorListItem("Custom FPGA"));
     sources->addSubItem(new ProcessorListItem("Rhythm FPGA"));
     sources->addSubItem(new ProcessorListItem("File Reader"));
     //sources->addSubItem(new ProcessorListItem("Event Generator"));
@@ -86,7 +72,7 @@ ProcessorList::ProcessorList()
     sinks->addSubItem(new ProcessorListItem("Spike Viewer"));
     //sinks->addSubItem(new ProcessorListItem("WiFi Output"));
     //sinks->addSubItem(new ProcessorListItem("Arduino Output"));
-   // sinks->addSubItem(new ProcessorListItem("FPGA Output"));
+    // sinks->addSubItem(new ProcessorListItem("FPGA Output"));
     sinks->addSubItem(new ProcessorListItem("Pulse Pal"));
 
     ProcessorListItem* utilities = new ProcessorListItem("Utilities");
diff --git a/Source/UI/UIComponent.cpp b/Source/UI/UIComponent.cpp
index f9de7eb391bfbc72533158217fd0e90b94fccbdd..3c5d341cb57b19e1458577551a137a728c27fa9f 100755
--- a/Source/UI/UIComponent.cpp
+++ b/Source/UI/UIComponent.cpp
@@ -92,7 +92,7 @@ UIComponent::UIComponent(MainWindow* mainWindow_, ProcessorGraph* pgraph, AudioC
     mainWindow->setMenuBar(this);
 #endif
 
-    //getEditorViewport()->loadState(File("/home/jsiegle/Programming/GUI/Builds/Linux/build/spike_display_2.xml"));
+    //getEditorViewport()->loadState(File("/home/jsiegle/Programming/GUI/Builds/Linux/build/test.xml"));
 
 }
 
@@ -385,9 +385,9 @@ bool UIComponent::perform(const InvocationInfo& info)
         case openConfiguration:
             {
                 FileChooser fc("Choose a file to load...",
-                      File::getCurrentWorkingDirectory(),
-                      "*.xml",
-                      true);
+                               File::getCurrentWorkingDirectory(),
+                               "*.xml",
+                               true);
 
                 if (fc.browseForFileToOpen())
                 {
@@ -405,9 +405,9 @@ bool UIComponent::perform(const InvocationInfo& info)
             {
 
                 FileChooser fc("Choose the file to save...",
-                   File::getCurrentWorkingDirectory(),
-                   "*",
-                   true);
+                               File::getCurrentWorkingDirectory(),
+                               "*",
+                               true);
 
                 if (fc.browseForFileToSave(true))
                 {
@@ -461,14 +461,14 @@ void UIComponent::saveStateToXml(XmlElement* xml)
 
 void UIComponent::loadStateFromXml(XmlElement* xml)
 {
-     forEachXmlChildElement(*xml, xmlNode)
-     {
+    forEachXmlChildElement(*xml, xmlNode)
+    {
         if (xmlNode->hasTagName("UICOMPONENT"))
         {
-            
+
             bool isProcessorListOpen = xmlNode->getBoolAttribute("isProcessorListOpen");
             bool isEditorViewportOpen = xmlNode->getBoolAttribute("isEditorViewportOpen");
-            
+
             if (!isProcessorListOpen)
             {
                 processorList->toggleState();