diff --git a/Builds/Linux/Makefile b/Builds/Linux/Makefile
index 1e76057ff82b7866a9a2cfedf05c333ce07c40b0..f4b250ab86399dcb7e7d5c093e99a9defd34b037 100644
--- a/Builds/Linux/Makefile
+++ b/Builds/Linux/Makefile
@@ -131,8 +131,6 @@ OBJECTS := \
   $(OBJDIR)/PeriStimulusTimeHistogramNode_9631ca2a.o \
   $(OBJDIR)/tictoc_cdca1ed.o \
   $(OBJDIR)/TrialCircularBuffer_4a4cef0c.o \
-  $(OBJDIR)/ReferenceNode_97454f26.o \
-  $(OBJDIR)/ReferenceNodeEditor_7d0ff573.o \
   $(OBJDIR)/ResamplingNode_9825590a.o \
   $(OBJDIR)/ResamplingNodeEditor_8b120457.o \
   $(OBJDIR)/PulsePal_14932a18.o \
@@ -605,16 +603,6 @@ $(OBJDIR)/TrialCircularBuffer_4a4cef0c.o: ../../Source/Processors/PSTH/TrialCirc
 	@echo "Compiling TrialCircularBuffer.cpp"
 	@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"
 
-$(OBJDIR)/ReferenceNode_97454f26.o: ../../Source/Processors/ReferenceNode/ReferenceNode.cpp
-	-@mkdir -p $(OBJDIR)
-	@echo "Compiling ReferenceNode.cpp"
-	@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"
-
-$(OBJDIR)/ReferenceNodeEditor_7d0ff573.o: ../../Source/Processors/ReferenceNode/ReferenceNodeEditor.cpp
-	-@mkdir -p $(OBJDIR)
-	@echo "Compiling ReferenceNodeEditor.cpp"
-	@$(CXX) $(CXXFLAGS) -o "$@" -c "$<"
-
 $(OBJDIR)/ResamplingNode_9825590a.o: ../../Source/Processors/ResamplingNode/ResamplingNode.cpp
 	-@mkdir -p $(OBJDIR)
 	@echo "Compiling ResamplingNode.cpp"
diff --git a/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj b/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj
index ffe527c70312c4c5c57f5a52c8e89ba00d9632d7..cb8bcf1edfb24e10e398145598be0b162454c2a3 100644
--- a/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj
+++ b/Builds/MacOSX/open-ephys.xcodeproj/project.pbxproj
@@ -101,8 +101,6 @@
 		093F0BA37D6C91C7E92AB658 = {isa = PBXBuildFile; fileRef = 25B9B8D5E54B9C547197E414; };
 		620CF6292EFB911F15916EA6 = {isa = PBXBuildFile; fileRef = 547C76794FAC1BC349163509; };
 		7B50AD44D4F9610CE4A43414 = {isa = PBXBuildFile; fileRef = FB827FEEA15A274E5F7577DB; };
-		A5A90525A975EC3B1E40086E = {isa = PBXBuildFile; fileRef = D9B10885C9D93CEF580EF167; };
-		79FC643530710BF2885932C1 = {isa = PBXBuildFile; fileRef = 6D4D435D25CFC019E0FCF4A1; };
 		69B5045877D4C674E8A4967F = {isa = PBXBuildFile; fileRef = E102C308B0722DFFFEFF2415; };
 		97105BCBC5B1BE4E86D48899 = {isa = PBXBuildFile; fileRef = 55DFE30C901793E56A7E3A22; };
 		790911EDF00A4BF77327D99A = {isa = PBXBuildFile; fileRef = 48E12736F471C43C959AD15C; };
@@ -626,7 +624,6 @@
 		670987D88775D6B240C34820 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_NotificationType.h"; path = "../../JuceLibraryCode/modules/juce_events/messages/juce_NotificationType.h"; sourceTree = "SOURCE_ROOT"; };
 		674FDCCEF6A1379A0F689004 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ComponentBoundsConstrainer.h"; path = "../../JuceLibraryCode/modules/juce_gui_basics/layout/juce_ComponentBoundsConstrainer.h"; sourceTree = "SOURCE_ROOT"; };
 		677CC8DA903C77D8ECBAE26D = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Params.h; path = ../../Source/Processors/Dsp/Params.h; sourceTree = "SOURCE_ROOT"; };
-		679BBE9F6C930A1941BA7944 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ReferenceNode.h; path = ../../Source/Processors/ReferenceNode/ReferenceNode.h; sourceTree = "SOURCE_ROOT"; };
 		67BB47E709B643D4C01AB34C = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_AudioDeviceSelectorComponent.cpp"; path = "../../JuceLibraryCode/modules/juce_audio_utils/gui/juce_AudioDeviceSelectorComponent.cpp"; sourceTree = "SOURCE_ROOT"; };
 		6832130272774CD542793762 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_mac_CoreGraphicsContext.mm"; path = "../../JuceLibraryCode/modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm"; sourceTree = "SOURCE_ROOT"; };
 		686FA8DDF2848517CBFB9E4A = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_MouseCursor.cpp"; path = "../../JuceLibraryCode/modules/juce_gui_basics/mouse/juce_MouseCursor.cpp"; sourceTree = "SOURCE_ROOT"; };
@@ -652,7 +649,6 @@
 		6D34DD9AB987A67BADE71C65 = {isa = PBXFileReference; lastKnownFileType = image.png; name = "RadioButtons-05.png"; path = "../../Resources/Images/Icons/RadioButtons-05.png"; sourceTree = "SOURCE_ROOT"; };
 		6D38B76951D31D96F1B71E0F = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = SerialInputEditor.cpp; path = ../../Source/Processors/SerialInput/SerialInputEditor.cpp; sourceTree = "SOURCE_ROOT"; };
 		6D4BA4399FDEB6D2195B257D = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_SplashScreen.h"; path = "../../JuceLibraryCode/modules/juce_gui_extra/misc/juce_SplashScreen.h"; sourceTree = "SOURCE_ROOT"; };
-		6D4D435D25CFC019E0FCF4A1 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ReferenceNodeEditor.cpp; path = ../../Source/Processors/ReferenceNode/ReferenceNodeEditor.cpp; sourceTree = "SOURCE_ROOT"; };
 		6D4DFC260B2966E3EBFC0C79 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_SliderPropertyComponent.cpp"; path = "../../JuceLibraryCode/modules/juce_gui_basics/properties/juce_SliderPropertyComponent.cpp"; sourceTree = "SOURCE_ROOT"; };
 		6D619C7A3A14981DC4EFF223 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_IIRFilterAudioSource.h"; path = "../../JuceLibraryCode/modules/juce_audio_basics/sources/juce_IIRFilterAudioSource.h"; sourceTree = "SOURCE_ROOT"; };
 		6D77949E9C7C9B5A7795C0E0 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_PathStrokeType.h"; path = "../../JuceLibraryCode/modules/juce_graphics/geometry/juce_PathStrokeType.h"; sourceTree = "SOURCE_ROOT"; };
@@ -785,7 +781,6 @@
 		880CC7C325EFF665AC3006D2 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_KeyListener.cpp"; path = "../../JuceLibraryCode/modules/juce_gui_basics/keyboard/juce_KeyListener.cpp"; sourceTree = "SOURCE_ROOT"; };
 		881237D5E366342B117C0ED7 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_WildcardFileFilter.cpp"; path = "../../JuceLibraryCode/modules/juce_gui_basics/filebrowser/juce_WildcardFileFilter.cpp"; sourceTree = "SOURCE_ROOT"; };
 		8822ADC9DB83FAF39B841E31 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Font.cpp"; path = "../../JuceLibraryCode/modules/juce_graphics/fonts/juce_Font.cpp"; sourceTree = "SOURCE_ROOT"; };
-		883E23B392AFB86C3EE1A2AC = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ReferenceNodeEditor.h; path = ../../Source/Processors/ReferenceNode/ReferenceNodeEditor.h; sourceTree = "SOURCE_ROOT"; };
 		8882F8EBE55F52FA8E519249 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_android_Files.cpp"; path = "../../JuceLibraryCode/modules/juce_core/native/juce_android_Files.cpp"; sourceTree = "SOURCE_ROOT"; };
 		88C69F0563A99BD2F7BF5FBB = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LfpDisplayEditor.cpp; path = ../../Source/Processors/LfpDisplayNode/LfpDisplayEditor.cpp; sourceTree = "SOURCE_ROOT"; };
 		88E5D0906646465409715828 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_PreferencesPanel.cpp"; path = "../../JuceLibraryCode/modules/juce_gui_extra/misc/juce_PreferencesPanel.cpp"; sourceTree = "SOURCE_ROOT"; };
@@ -1171,7 +1166,6 @@
 		D8AFDCC674A7514B7019EEA6 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_DrawableButton.h"; path = "../../JuceLibraryCode/modules/juce_gui_basics/buttons/juce_DrawableButton.h"; sourceTree = "SOURCE_ROOT"; };
 		D952A208CC8164F0B459EC9E = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_linux_WebBrowserComponent.cpp"; path = "../../JuceLibraryCode/modules/juce_gui_extra/native/juce_linux_WebBrowserComponent.cpp"; sourceTree = "SOURCE_ROOT"; };
 		D960588B732D973B82500E2D = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_AudioProcessorListener.h"; path = "../../JuceLibraryCode/modules/juce_audio_processors/processors/juce_AudioProcessorListener.h"; sourceTree = "SOURCE_ROOT"; };
-		D9B10885C9D93CEF580EF167 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ReferenceNode.cpp; path = ../../Source/Processors/ReferenceNode/ReferenceNode.cpp; sourceTree = "SOURCE_ROOT"; };
 		D9BF6DA66C22FFF5C4D41991 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LfpDisplayCanvas.cpp; path = ../../Source/Processors/LfpDisplayNode/LfpDisplayCanvas.cpp; sourceTree = "SOURCE_ROOT"; };
 		D9C9FCA6D705B72B80DB1142 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Socket.cpp"; path = "../../JuceLibraryCode/modules/juce_core/network/juce_Socket.cpp"; sourceTree = "SOURCE_ROOT"; };
 		D9CB4CEC2C07346BE69262A0 = {isa = PBXFileReference; lastKnownFileType = image.png; name = "RadioButtons_selected-01.png"; path = "../../Resources/Images/Icons/RadioButtons_selected-01.png"; sourceTree = "SOURCE_ROOT"; };
@@ -1257,6 +1251,7 @@
 		EA9518CDEA7049C21D5CE2D5 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Process.h"; path = "../../JuceLibraryCode/modules/juce_core/threads/juce_Process.h"; sourceTree = "SOURCE_ROOT"; };
 		EAB6A66678B122C578B16445 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_HighResolutionTimer.h"; path = "../../JuceLibraryCode/modules/juce_core/threads/juce_HighResolutionTimer.h"; sourceTree = "SOURCE_ROOT"; };
 		EAC262A83CD2BEA14542AE89 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StringPool.h"; path = "../../JuceLibraryCode/modules/juce_core/text/juce_StringPool.h"; sourceTree = "SOURCE_ROOT"; };
+		EAEA49B9394D802B79CA8164 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StringPairArray.h"; path = "../../JuceLibraryCode/modules/juce_core/text/juce_StringPairArray.h"; sourceTree = "SOURCE_ROOT"; };
 		EDA209B0E7D124EA581023AD = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_AudioFormatManager.h"; path = "../../JuceLibraryCode/modules/juce_audio_formats/format/juce_AudioFormatManager.h"; sourceTree = "SOURCE_ROOT"; };
 		EF3F9AA8D70E1D4D55F13182 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_AudioThumbnail.cpp"; path = "../../JuceLibraryCode/modules/juce_audio_utils/gui/juce_AudioThumbnail.cpp"; sourceTree = "SOURCE_ROOT"; };
 		F5A00ACFA3D76168F22F1205 = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
@@ -1270,7 +1265,6 @@
 		EAB2319C7AA57E06A2247CDF = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_BorderSize.h"; path = "../../JuceLibraryCode/modules/juce_graphics/geometry/juce_BorderSize.h"; sourceTree = "SOURCE_ROOT"; };
 		EAB637B566FEBBDADA654262 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_VSTMidiEventList.h"; path = "../../JuceLibraryCode/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h"; sourceTree = "SOURCE_ROOT"; };
 		EAC7A64301F0BF2C5E33A1F9 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_InterprocessConnectionServer.cpp"; path = "../../JuceLibraryCode/modules/juce_events/interprocess/juce_InterprocessConnectionServer.cpp"; sourceTree = "SOURCE_ROOT"; };
-		EAEA49B9394D802B79CA8164 = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StringPairArray.h"; path = "../../JuceLibraryCode/modules/juce_core/text/juce_StringPairArray.h"; sourceTree = "SOURCE_ROOT"; };
 		EB5F9A50EB53A57D6AE303C2 = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_mac_QuickTimeMovieComponent.mm"; path = "../../JuceLibraryCode/modules/juce_video/native/juce_mac_QuickTimeMovieComponent.mm"; sourceTree = "SOURCE_ROOT"; };
 		EBD8622EAEF10558809888B7 = {isa = PBXFileReference; lastKnownFileType = image.png; name = "RadioButtons_selected_over-01.png"; path = "../../Resources/Images/Icons/RadioButtons_selected_over-01.png"; sourceTree = "SOURCE_ROOT"; };
 		EC95A2CF4B33EA37DA5FC1AC = {isa = PBXFileReference; lastKnownFileType = file.ttf; name = nordic.ttf; path = ../../Resources/Fonts/nordic.ttf; sourceTree = "SOURCE_ROOT"; };
@@ -1624,11 +1618,6 @@
 					CCE779E203974113A80D6D85,
 					FB827FEEA15A274E5F7577DB,
 					76D8904379362E11CA4EA11D, ); name = PSTH; sourceTree = "<group>"; };
-		21389ED521B378402213EFC3 = {isa = PBXGroup; children = (
-					D9B10885C9D93CEF580EF167,
-					679BBE9F6C930A1941BA7944,
-					6D4D435D25CFC019E0FCF4A1,
-					883E23B392AFB86C3EE1A2AC, ); name = ReferenceNode; sourceTree = "<group>"; };
 		456FCC98D03DFAE9AFEC271B = {isa = PBXGroup; children = (
 					E102C308B0722DFFFEFF2415,
 					B574136FEE7957F7439CB346,
@@ -1715,7 +1704,6 @@
 					0E7092A11A3C96E5ECA71CDA,
 					2206667D18B61DE29C856408,
 					70AFD6EB1539BF938821F7A8,
-					21389ED521B378402213EFC3,
 					456FCC98D03DFAE9AFEC271B,
 					3DE49DED45C5CDD8D184E248,
 					C451C93CE8C359C1A4BD23C7,
@@ -3027,8 +3015,6 @@
 					093F0BA37D6C91C7E92AB658,
 					620CF6292EFB911F15916EA6,
 					7B50AD44D4F9610CE4A43414,
-					A5A90525A975EC3B1E40086E,
-					79FC643530710BF2885932C1,
 					69B5045877D4C674E8A4967F,
 					97105BCBC5B1BE4E86D48899,
 					790911EDF00A4BF77327D99A,
diff --git a/Builds/VisualStudio2012/open-ephys.vcxproj b/Builds/VisualStudio2012/open-ephys.vcxproj
index 35468aa4989628f5d6b4e3240c094747b8a174c5..1e653090b46b34f95c010bb46d492c01ad15e1ca 100644
--- a/Builds/VisualStudio2012/open-ephys.vcxproj
+++ b/Builds/VisualStudio2012/open-ephys.vcxproj
@@ -343,8 +343,6 @@
     <ClCompile Include="..\..\Source\Processors\PSTH\PeriStimulusTimeHistogramNode.cpp"/>
     <ClCompile Include="..\..\Source\Processors\PSTH\tictoc.cpp"/>
     <ClCompile Include="..\..\Source\Processors\PSTH\TrialCircularBuffer.cpp"/>
-    <ClCompile Include="..\..\Source\Processors\ReferenceNode\ReferenceNode.cpp"/>
-    <ClCompile Include="..\..\Source\Processors\ReferenceNode\ReferenceNodeEditor.cpp"/>
     <ClCompile Include="..\..\Source\Processors\ResamplingNode\ResamplingNode.cpp"/>
     <ClCompile Include="..\..\Source\Processors\ResamplingNode\ResamplingNodeEditor.cpp"/>
     <ClCompile Include="..\..\Source\Processors\Serial\PulsePal.cpp"/>
@@ -1594,8 +1592,6 @@
     <ClInclude Include="..\..\Source\Processors\PSTH\PeriStimulusTimeHistogramNode.h"/>
     <ClInclude Include="..\..\Source\Processors\PSTH\tictoc.h"/>
     <ClInclude Include="..\..\Source\Processors\PSTH\TrialCircularBuffer.h"/>
-    <ClInclude Include="..\..\Source\Processors\ReferenceNode\ReferenceNode.h"/>
-    <ClInclude Include="..\..\Source\Processors\ReferenceNode\ReferenceNodeEditor.h"/>
     <ClInclude Include="..\..\Source\Processors\ResamplingNode\ResamplingNode.h"/>
     <ClInclude Include="..\..\Source\Processors\ResamplingNode\ResamplingNodeEditor.h"/>
     <ClInclude Include="..\..\Source\Processors\Serial\PulsePal.h"/>
diff --git a/Builds/VisualStudio2012/open-ephys.vcxproj.filters b/Builds/VisualStudio2012/open-ephys.vcxproj.filters
index 2dbfbab54e9c9ffcd8483fe5984404d6526b83c1..b0ccd22aab60f10b7b3e6cf3a0075eda82c9906e 100644
--- a/Builds/VisualStudio2012/open-ephys.vcxproj.filters
+++ b/Builds/VisualStudio2012/open-ephys.vcxproj.filters
@@ -104,9 +104,6 @@
     <Filter Include="open-ephys\Source\Processors\PSTH">
       <UniqueIdentifier>{2714D3F1-1A51-5CEC-5EE2-26686D9EEAF8}</UniqueIdentifier>
     </Filter>
-    <Filter Include="open-ephys\Source\Processors\ReferenceNode">
-      <UniqueIdentifier>{763A6B4C-B0C6-BA22-7FAB-0DEEF8D66097}</UniqueIdentifier>
-    </Filter>
     <Filter Include="open-ephys\Source\Processors\ResamplingNode">
       <UniqueIdentifier>{3135385A-1E61-FB08-3E00-D5C52DFB1BC9}</UniqueIdentifier>
     </Filter>
@@ -679,12 +676,6 @@
     <ClCompile Include="..\..\Source\Processors\PSTH\TrialCircularBuffer.cpp">
       <Filter>open-ephys\Source\Processors\PSTH</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\Source\Processors\ReferenceNode\ReferenceNode.cpp">
-      <Filter>open-ephys\Source\Processors\ReferenceNode</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\Source\Processors\ReferenceNode\ReferenceNodeEditor.cpp">
-      <Filter>open-ephys\Source\Processors\ReferenceNode</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\Source\Processors\ResamplingNode\ResamplingNode.cpp">
       <Filter>open-ephys\Source\Processors\ResamplingNode</Filter>
     </ClCompile>
@@ -2289,12 +2280,6 @@
     <ClInclude Include="..\..\Source\Processors\PSTH\TrialCircularBuffer.h">
       <Filter>open-ephys\Source\Processors\PSTH</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\Source\Processors\ReferenceNode\ReferenceNode.h">
-      <Filter>open-ephys\Source\Processors\ReferenceNode</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\Source\Processors\ReferenceNode\ReferenceNodeEditor.h">
-      <Filter>open-ephys\Source\Processors\ReferenceNode</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\Source\Processors\ResamplingNode\ResamplingNode.h">
       <Filter>open-ephys\Source\Processors\ResamplingNode</Filter>
     </ClInclude>
diff --git a/Builds/VisualStudio2013/open-ephys.vcxproj b/Builds/VisualStudio2013/open-ephys.vcxproj
index 2d1a1de783db4a8fb5b189d6b1907346ddc80e05..2c2e5eaf86bedefc1d2d2bf412368e60cff71b09 100644
--- a/Builds/VisualStudio2013/open-ephys.vcxproj
+++ b/Builds/VisualStudio2013/open-ephys.vcxproj
@@ -347,8 +347,6 @@
     <ClCompile Include="..\..\Source\Processors\PSTH\PeriStimulusTimeHistogramNode.cpp"/>
     <ClCompile Include="..\..\Source\Processors\PSTH\tictoc.cpp"/>
     <ClCompile Include="..\..\Source\Processors\PSTH\TrialCircularBuffer.cpp"/>
-    <ClCompile Include="..\..\Source\Processors\ReferenceNode\ReferenceNode.cpp"/>
-    <ClCompile Include="..\..\Source\Processors\ReferenceNode\ReferenceNodeEditor.cpp"/>
     <ClCompile Include="..\..\Source\Processors\ResamplingNode\ResamplingNode.cpp"/>
     <ClCompile Include="..\..\Source\Processors\ResamplingNode\ResamplingNodeEditor.cpp"/>
     <ClCompile Include="..\..\Source\Processors\Serial\PulsePal.cpp"/>
@@ -1598,8 +1596,6 @@
     <ClInclude Include="..\..\Source\Processors\PSTH\PeriStimulusTimeHistogramNode.h"/>
     <ClInclude Include="..\..\Source\Processors\PSTH\tictoc.h"/>
     <ClInclude Include="..\..\Source\Processors\PSTH\TrialCircularBuffer.h"/>
-    <ClInclude Include="..\..\Source\Processors\ReferenceNode\ReferenceNode.h"/>
-    <ClInclude Include="..\..\Source\Processors\ReferenceNode\ReferenceNodeEditor.h"/>
     <ClInclude Include="..\..\Source\Processors\ResamplingNode\ResamplingNode.h"/>
     <ClInclude Include="..\..\Source\Processors\ResamplingNode\ResamplingNodeEditor.h"/>
     <ClInclude Include="..\..\Source\Processors\Serial\PulsePal.h"/>
diff --git a/Builds/VisualStudio2013/open-ephys.vcxproj.filters b/Builds/VisualStudio2013/open-ephys.vcxproj.filters
index d58540ef75bb009978b47ecd6641a839e18059bf..1251522bb6537167fe39418f84eefb817ea90604 100644
--- a/Builds/VisualStudio2013/open-ephys.vcxproj.filters
+++ b/Builds/VisualStudio2013/open-ephys.vcxproj.filters
@@ -104,9 +104,6 @@
     <Filter Include="open-ephys\Source\Processors\PSTH">
       <UniqueIdentifier>{2714D3F1-1A51-5CEC-5EE2-26686D9EEAF8}</UniqueIdentifier>
     </Filter>
-    <Filter Include="open-ephys\Source\Processors\ReferenceNode">
-      <UniqueIdentifier>{763A6B4C-B0C6-BA22-7FAB-0DEEF8D66097}</UniqueIdentifier>
-    </Filter>
     <Filter Include="open-ephys\Source\Processors\ResamplingNode">
       <UniqueIdentifier>{3135385A-1E61-FB08-3E00-D5C52DFB1BC9}</UniqueIdentifier>
     </Filter>
@@ -679,12 +676,6 @@
     <ClCompile Include="..\..\Source\Processors\PSTH\TrialCircularBuffer.cpp">
       <Filter>open-ephys\Source\Processors\PSTH</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\Source\Processors\ReferenceNode\ReferenceNode.cpp">
-      <Filter>open-ephys\Source\Processors\ReferenceNode</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\Source\Processors\ReferenceNode\ReferenceNodeEditor.cpp">
-      <Filter>open-ephys\Source\Processors\ReferenceNode</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\Source\Processors\ResamplingNode\ResamplingNode.cpp">
       <Filter>open-ephys\Source\Processors\ResamplingNode</Filter>
     </ClCompile>
@@ -2289,12 +2280,6 @@
     <ClInclude Include="..\..\Source\Processors\PSTH\TrialCircularBuffer.h">
       <Filter>open-ephys\Source\Processors\PSTH</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\Source\Processors\ReferenceNode\ReferenceNode.h">
-      <Filter>open-ephys\Source\Processors\ReferenceNode</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\Source\Processors\ReferenceNode\ReferenceNodeEditor.h">
-      <Filter>open-ephys\Source\Processors\ReferenceNode</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\Source\Processors\ResamplingNode\ResamplingNode.h">
       <Filter>open-ephys\Source\Processors\ResamplingNode</Filter>
     </ClInclude>
diff --git a/Source/Processors/DataThreads/RHD2000Editor.cpp b/Source/Processors/DataThreads/RHD2000Editor.cpp
index 37a713fa2e789b39d7156b6d63b0d03973aa9fe4..b2c3fea9d80b0b74b06c037976b4d81b0e91b643 100644
--- a/Source/Processors/DataThreads/RHD2000Editor.cpp
+++ b/Source/Processors/DataThreads/RHD2000Editor.cpp
@@ -710,7 +710,7 @@ void RHD2000Editor::measureImpedance()
 		for (int i = 0; i < channel.size(); i++)
 		{
 			XmlElement* chan = new XmlElement("CHANNEL");
-			chan->setAttribute("name",board->getChannelName(DATA_CHANNEL,stream[i],channel[i]));
+			chan->setAttribute("name",board->getChannelName(HEADSTAGE_CHANNEL,stream[i],channel[i]));
 			chan->setAttribute("stream",stream[i]);
 			chan->setAttribute("channel_number",channel[i]);
 			chan->setAttribute("magnitude",magnitude[i]);
diff --git a/Source/Processors/DataThreads/RHD2000Thread.cpp b/Source/Processors/DataThreads/RHD2000Thread.cpp
index 8f0478fa2225e36e9c00ab2f9b686e127e19e78f..3ee8abda0a86eb3ce1f4fd747d95d88abfea8e70 100644
--- a/Source/Processors/DataThreads/RHD2000Thread.cpp
+++ b/Source/Processors/DataThreads/RHD2000Thread.cpp
@@ -753,7 +753,7 @@ int RHD2000Thread::modifyChannelName(ChannelType t, int str, int ch, String newN
     return -1;
 }
 
-String RHD2000Thread::getChannelName(channelType t, int str, int ch)
+String RHD2000Thread::getChannelName(ChannelType t, int str, int ch)
 {
 	for (int k=0; k<Names.size(); k++)
     {
@@ -764,7 +764,7 @@ String RHD2000Thread::getChannelName(channelType t, int str, int ch)
     }
 }
 
-int RHD2000Thread::modifyChannelGain(channelType t, int str, int ch, float gain)
+int RHD2000Thread::modifyChannelGain(ChannelType t, int str, int ch, float gain)
 {
     String dummy;
     float dummyFloat = 0;
diff --git a/Source/Processors/DataThreads/RHD2000Thread.h b/Source/Processors/DataThreads/RHD2000Thread.h
index f7d1e259289dfc68d9c401e9777b77fec306cbf6..6eb6c031de3f59ef9346261b51a5ad3efed7e173 100644
--- a/Source/Processors/DataThreads/RHD2000Thread.h
+++ b/Source/Processors/DataThreads/RHD2000Thread.h
@@ -119,7 +119,7 @@ public:
     void setDACthreshold(int dacOutput, float threshold);
     void setDefaultNamingScheme(int scheme);
 
-	String getChannelName(channelType t, int str, int ch);
+	String getChannelName(ChannelType t, int str, int ch);
 
 private:
     void setDefaultChannelNamesAndType();
diff --git a/Source/Processors/FileReader/FileReader.cpp b/Source/Processors/FileReader/FileReader.cpp
index ed650bac9500352aff1e27d203fe24ccd30a8fd0..33386f1f6f6df5a64ae6ab507a756338f263cfc8 100644
--- a/Source/Processors/FileReader/FileReader.cpp
+++ b/Source/Processors/FileReader/FileReader.cpp
@@ -72,7 +72,7 @@ float FileReader::getDefaultSampleRate()
         return 44100.0;
 }
 
-int FileReader::getNumHeadstageOutputs()
+int FileReader::getDefaultNumOutputs()
 {
     if (input)
         return currentNumChannels;
@@ -80,7 +80,7 @@ int FileReader::getNumHeadstageOutputs()
         return 16;
 }
 
-float FileReader::getBitVolts(Channel* ch)
+float FileReader::getBitVolts(int chan)
 {
     if (input)
         return channelInfo[chan].bitVolts;
@@ -174,27 +174,45 @@ void FileReader::process(AudioSampleBuffer& buffer, MidiBuffer& events)
 
     setTimestamp(events, timestamp);
 
+    // FIXME: needs to account for the fact that the ratio might not be an exact
+    //        integer value
+
+    // code for testing events:
+    // if (counter > 100)
+    // {
+    //     addEvent(events,    // MidiBuffer
+    //          TTL, // eventType
+    //          0,         // sampleNum
+    //          1,    // eventID
+    //          0      // eventChannel
+    //         );
+    //     counter = 0;
+    // } else {
+    //     counter++;
+
+    // }
+
     int samplesNeeded = (int) float(buffer.getNumSamples()) * (getDefaultSampleRate()/44100.0f);
 
-    int samplesReaded = 0;
+    int samplesRead = 0;
 
-    while (samplesReaded < samplesNeeded)
+    while (samplesRead < samplesNeeded)
     {
-        int samplesToRead = samplesNeeded - samplesReaded;
+        int samplesToRead = samplesNeeded - samplesRead;
         if ((currentSample + samplesToRead) > stopSample)
         {
             samplesToRead = stopSample - currentSample;
             if (samplesToRead > 0)
-                input->readData(readBuffer+samplesReaded,samplesToRead);
+                input->readData(readBuffer+samplesRead,samplesToRead);
             input->seekTo(startSample);
             currentSample = startSample;
         }
         else
         {
-            input->readData(readBuffer+samplesReaded,samplesToRead);
+            input->readData(readBuffer+samplesRead,samplesToRead);
             currentSample += samplesToRead;
         }
-        samplesReaded += samplesToRead;
+        samplesRead += samplesToRead;
     }
     for (int i=0; i < currentNumChannels; i++)
     {
@@ -202,10 +220,7 @@ void FileReader::process(AudioSampleBuffer& buffer, MidiBuffer& events)
     }
 
     timestamp += samplesNeeded;
-    static_cast<FileReaderEditor*>(getEditor())->setCurrentTime(samplesToMilliseconds(currentSample));
-
-    setNumSamples(events, samplesNeeded);//samplesNeeded);
-    setTimestamp(events, timestamp);
+    setNumSamples(events, samplesNeeded);
 
 }
 
diff --git a/Source/Processors/FileReader/FileReader.h b/Source/Processors/FileReader/FileReader.h
index fb5cf3534f71989d0023bf72e2bc775bbdd563b1..5d77a4e50fc3deb96c1355d368823a5726c60f51 100644
--- a/Source/Processors/FileReader/FileReader.h
+++ b/Source/Processors/FileReader/FileReader.h
@@ -71,8 +71,8 @@ public:
     void enabledState(bool t);
 
     float getDefaultSampleRate();
-    int getNumHeadstageOutputs();
-    float getBitVolts(Channel* ch);
+    int getDefaultNumOutputs();
+    float getBitVolts(int chan);
 
     bool setFile(String fullpath);
     String getFile();
diff --git a/Source/Processors/LfpDisplayNode/LfpDisplayCanvas.cpp b/Source/Processors/LfpDisplayNode/LfpDisplayCanvas.cpp
index a2414f142355e7318bfad808657181bf1651647b..5327cb5583c467114b8a3dff633fd0bc6def1ca7 100755
--- a/Source/Processors/LfpDisplayNode/LfpDisplayCanvas.cpp
+++ b/Source/Processors/LfpDisplayNode/LfpDisplayCanvas.cpp
@@ -62,13 +62,11 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
 
     //viewport->getVerticalScrollBar()->addListener(this->scrollBarMoved(viewport->getVerticalScrollBar(), 1.0));
 
-
+    UtilityButton* tbut;
 
     addAndMakeVisible(viewport);
     addAndMakeVisible(timescale);
 
-	UtilityButton* tbut;
-
     //Ranges for neural data
      voltageRanges[HEADSTAGE_CHANNEL].add("25");
     voltageRanges[HEADSTAGE_CHANNEL].add("50");
@@ -80,22 +78,23 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
     voltageRanges[HEADSTAGE_CHANNEL].add("1000");
     voltageRanges[HEADSTAGE_CHANNEL].add("2000");
     voltageRanges[HEADSTAGE_CHANNEL].add("5000");
-	voltageRanges[HEADSTAGE_CHANNEL].add("10000");
-	selectedVoltageRange[HEADSTAGE_CHANNEL] = 8;
-	rangeGain[HEADSTAGE_CHANNEL] = 1; //uV
-	rangeSteps[HEADSTAGE_CHANNEL] = 10;
-	rangeUnits.add("uV");
-	typeNames.add("DATA");
-	tbut  = new UtilityButton("DATA",Font("Small Text", 9, Font::plain));
-	tbut->setEnabledState(true);
-	tbut->setCorners(false,false,false,false);
-	tbut->addListener(this);
-	tbut->setClickingTogglesState(true);
-	tbut->setRadioGroupId(100,dontSendNotification);
-	tbut->setToggleState(true,dontSendNotification);
-	addAndMakeVisible(tbut);
-	typeButtons.add(tbut);
-	
+    voltageRanges[HEADSTAGE_CHANNEL].add("10000");
+    selectedVoltageRange[HEADSTAGE_CHANNEL] = 8;
+    rangeGain[HEADSTAGE_CHANNEL] = 1; //uV
+    rangeSteps[HEADSTAGE_CHANNEL] = 10;
+    rangeUnits.add("uV");
+    typeNames.add("DATA");
+
+    tbut = new UtilityButton("DATA",Font("Small Text", 9, Font::plain));
+    tbut->setEnabledState(true);
+    tbut->setCorners(false,false,false,false);
+    tbut->addListener(this);
+    tbut->setClickingTogglesState(true);
+    tbut->setRadioGroupId(100,dontSendNotification);
+    tbut->setToggleState(true,dontSendNotification);
+    addAndMakeVisible(tbut);
+    typeButtons.add(tbut);
+    
 
     //Ranges for AUX/accelerometer data
     voltageRanges[AUX_CHANNEL].add("25");
@@ -108,20 +107,21 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
     voltageRanges[AUX_CHANNEL].add("1000");
     voltageRanges[AUX_CHANNEL].add("2000");
     voltageRanges[AUX_CHANNEL].add("5000");
-	selectedVoltageRange[AUX_CHANNEL] = 6;
-	rangeGain[AUX_CHANNEL] = 1; //uV
-	rangeSteps[AUX_CHANNEL] = 10;
-	rangeUnits.add("uV");
-	typeNames.add("AUX");
-	tbut  = new UtilityButton("AUX",Font("Small Text", 9, Font::plain));
-	tbut->setEnabledState(true);
-	tbut->setCorners(false,false,false,false);
-	tbut->addListener(this);
-	tbut->setClickingTogglesState(true);
-	tbut->setRadioGroupId(100,dontSendNotification);
-	tbut->setToggleState(false,dontSendNotification);
-	addAndMakeVisible(tbut);
-	typeButtons.add(tbut);
+    selectedVoltageRange[AUX_CHANNEL] = 6;
+    rangeGain[AUX_CHANNEL] = 1; //uV
+    rangeSteps[AUX_CHANNEL] = 10;
+    rangeUnits.add("uV");
+    typeNames.add("AUX");
+
+    tbut = new UtilityButton("AUX",Font("Small Text", 9, Font::plain));
+    tbut->setEnabledState(true);
+    tbut->setCorners(false,false,false,false);
+    tbut->addListener(this);
+    tbut->setClickingTogglesState(true);
+    tbut->setRadioGroupId(100,dontSendNotification);
+    tbut->setToggleState(false,dontSendNotification);
+    addAndMakeVisible(tbut);
+    typeButtons.add(tbut);
 
     //Ranges for ADC data
      voltageRanges[ADC_CHANNEL].add("0.01");
@@ -130,28 +130,29 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
     voltageRanges[ADC_CHANNEL].add("0.5");
     voltageRanges[ADC_CHANNEL].add("1.0");
     voltageRanges[ADC_CHANNEL].add("2.0");
-	voltageRanges[ADC_CHANNEL].add("5.0");
-	voltageRanges[ADC_CHANNEL].add("10.0");
-	selectedVoltageRange[ADC_CHANNEL] = 8;
-	rangeGain[ADC_CHANNEL] = 1; //V
-	rangeSteps[ADC_CHANNEL] = 0.1; //in V
-	rangeUnits.add("V");
-	typeNames.add("ADC");
-	tbut  = new UtilityButton("ADC",Font("Small Text", 9, Font::plain));
-	tbut->setEnabledState(true);
-	tbut->setCorners(false,false,false,false);
-	tbut->addListener(this);
-	tbut->setClickingTogglesState(true);
-	tbut->setRadioGroupId(100,dontSendNotification);
-	tbut->setToggleState(false,dontSendNotification);
-	addAndMakeVisible(tbut);
-	typeButtons.add(tbut);
-
-	selectedVoltageRangeValues[HEADSTAGE_CHANNEL] = voltageRanges[HEADSTAGE_CHANNEL][selectedVoltageRange[HEADSTAGE_CHANNEL]-1];
-	selectedVoltageRangeValues[AUX_CHANNEL] = voltageRanges[AUX_CHANNEL][selectedVoltageRange[AUX_CHANNEL]-1];
-	selectedVoltageRangeValues[ADC_CHANNEL] = voltageRanges[ADC_CHANNEL][selectedVoltageRange[ADC_CHANNEL]-1];
-
-	timebases.add("0.25");
+    voltageRanges[ADC_CHANNEL].add("5.0");
+    voltageRanges[ADC_CHANNEL].add("10.0");
+    selectedVoltageRange[ADC_CHANNEL] = 8;
+    rangeGain[ADC_CHANNEL] = 1; //V
+    rangeSteps[ADC_CHANNEL] = 0.1; //in V
+    rangeUnits.add("V");
+    typeNames.add("ADC");
+
+    tbut = new UtilityButton("ADC",Font("Small Text", 9, Font::plain));
+    tbut->setEnabledState(true);
+    tbut->setCorners(false,false,false,false);
+    tbut->addListener(this);
+    tbut->setClickingTogglesState(true);
+    tbut->setRadioGroupId(100,dontSendNotification);
+    tbut->setToggleState(false,dontSendNotification);
+    addAndMakeVisible(tbut);
+    typeButtons.add(tbut);
+
+    selectedVoltageRangeValues[HEADSTAGE_CHANNEL] = voltageRanges[HEADSTAGE_CHANNEL][selectedVoltageRange[HEADSTAGE_CHANNEL]-1];
+    selectedVoltageRangeValues[AUX_CHANNEL] = voltageRanges[AUX_CHANNEL][selectedVoltageRange[AUX_CHANNEL]-1];
+    selectedVoltageRangeValues[ADC_CHANNEL] = voltageRanges[ADC_CHANNEL][selectedVoltageRange[ADC_CHANNEL]-1];
+
+    timebases.add("0.25");
     timebases.add("0.5");
     timebases.add("1.0");
     timebases.add("2.0");
@@ -160,8 +161,8 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
     timebases.add("5.0");
     timebases.add("10.0");
     timebases.add("20.0");
-	selectedTimebase = 4;
-	selectedTimebaseValue = timebases[selectedTimebase-1];
+    selectedTimebase = 4;
+    selectedTimebaseValue = timebases[selectedTimebase-1];
 
     spreads.add("10");
     spreads.add("20");
@@ -173,8 +174,8 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
     spreads.add("80");
     spreads.add("90");
     spreads.add("100");
-	selectedSpread = 5;
-	selectedSpreadValue = spreads[selectedSpread-1];
+    selectedSpread = 5;
+    selectedSpreadValue = spreads[selectedSpread-1];
 
     colorGroupings.add("1");
     colorGroupings.add("2");
@@ -185,25 +186,25 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
 
     rangeSelection = new ComboBox("Voltage range");
     rangeSelection->addItemList(voltageRanges[HEADSTAGE_CHANNEL], 1);
-	rangeSelection->setSelectedId(selectedVoltageRange[HEADSTAGE_CHANNEL], sendNotification);
-	rangeSelection->setEditableText(true);
+    rangeSelection->setSelectedId(selectedVoltageRange[HEADSTAGE_CHANNEL], sendNotification);
+    rangeSelection->setEditableText(true);
     rangeSelection->addListener(this);
     addAndMakeVisible(rangeSelection);
 
 
     timebaseSelection = new ComboBox("Timebase");
     timebaseSelection->addItemList(timebases, 1);
-	timebaseSelection->setSelectedId(selectedTimebase, sendNotification);
-	timebaseSelection->setEditableText(true);
+    timebaseSelection->setSelectedId(selectedTimebase, sendNotification);
+    timebaseSelection->setEditableText(true);
     timebaseSelection->addListener(this);
     addAndMakeVisible(timebaseSelection);
 
 
     spreadSelection = new ComboBox("Spread");
     spreadSelection->addItemList(spreads, 1);
-	spreadSelection->setSelectedId(selectedSpread,sendNotification);
+    spreadSelection->setSelectedId(selectedSpread,sendNotification);
     spreadSelection->addListener(this);
-	spreadSelection->setEditableText(true);
+    spreadSelection->setEditableText(true);
     addAndMakeVisible(spreadSelection);
 
     colorGroupingSelection = new ComboBox("Color Grouping");
@@ -243,8 +244,8 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
 
 
     lfpDisplay->setNumChannels(nChans);
-	lfpDisplay->setRange(voltageRanges[HEADSTAGE_CHANNEL][selectedVoltageRange[HEADSTAGE_CHANNEL]-1].getFloatValue()*rangeGain[HEADSTAGE_CHANNEL]
-		,HEADSTAGE_CHANNEL);
+    lfpDisplay->setRange(voltageRanges[HEADSTAGE_CHANNEL][selectedVoltageRange[HEADSTAGE_CHANNEL]-1].getFloatValue()*rangeGain[HEADSTAGE_CHANNEL]
+        ,HEADSTAGE_CHANNEL);
 
     // add event display-specific controls (currently just an enable/disable button)
     for (int i = 0; i < 8; i++)
@@ -300,12 +301,11 @@ void LfpDisplayCanvas::resized()
         eventDisplayInterfaces[i]->repaint();
     }
 
-	int bh = 25/typeButtons.size();
-	for (int i = 0; i < typeButtons.size(); i++)
-	{
-		typeButtons[i]->setBounds(110,getHeight()-30+i*bh,50,bh);
-	}
-
+    int bh = 25/typeButtons.size();
+    for (int i = 0; i < typeButtons.size(); i++)
+    {
+        typeButtons[i]->setBounds(110,getHeight()-30+i*bh,50,bh);
+    }
     // std::cout << "Canvas thinks LfpDisplay should be this high: "
     //  << lfpDisplay->getTotalHeight() << std::endl;
 
@@ -338,7 +338,7 @@ void LfpDisplayCanvas::update()
 
     sampleRate.clear();
     screenBufferIndex.clear();
-	lastScreenBufferIndex.clear();
+    lastScreenBufferIndex.clear();
     displayBufferIndex.clear();
 
     for (int i = 0; i < nChans; i++)
@@ -346,17 +346,17 @@ void LfpDisplayCanvas::update()
         sampleRate.add(processor->channels[i]->sampleRate);
         displayBufferIndex.add(0);
         screenBufferIndex.add(0);
-		lastScreenBufferIndex.add(0);
+        lastScreenBufferIndex.add(0);
     }
 
     if (nChans != lfpDisplay->getNumChannels())
     {
         std::cout << "Setting num inputs on LfpDisplayCanvas to " << nChans << std::endl;
 
-        lfpDisplay->setNumChannels(nChans);
-
         refreshScreenBuffer();
 
+        lfpDisplay->setNumChannels(nChans);
+
         // update channel names
         for (int i = 0; i < processor->getNumInputs(); i++)
         {
@@ -374,15 +374,15 @@ void LfpDisplayCanvas::update()
 
         resized();
     }
-	else
-	{
-		for (int i = 0; i < processor->getNumInputs(); i++)
+    else
+    {
+        for (int i = 0; i < processor->getNumInputs(); i++)
         {
-			lfpDisplay->channels[i]->updateType();
-			lfpDisplay->channelInfo[i]->updateType();
-		}
-		
-	}
+            lfpDisplay->channels[i]->updateType();
+            lfpDisplay->channelInfo[i]->updateType();
+        }
+        
+    }
 
 }
 
@@ -391,31 +391,32 @@ void LfpDisplayCanvas::buttonClicked(Button* b)
     if (b == invertInputButton)
     {
         lfpDisplay->setInputInverted(b->getToggleState());
-		return;
+        return;
     }
     if (b == drawMethodButton)
     {
         lfpDisplay->setDrawMethod(b->getToggleState());
-		return;
+        return;
     }
     if (b == pauseButton)
     {
         lfpDisplay->isPaused = b->getToggleState();
-		return;
+        return;
+    }
+
+    int idx = typeButtons.indexOf((UtilityButton*)b);
+    if ((idx >= 0) && (b->getToggleState()))
+    {
+        for (int i = 0; i < processor->getNumInputs(); i++)
+        {
+            if (lfpDisplay->channels[i]->getSelected())
+            {
+                lfpDisplay->channels[i]->deselect();
+                lfpDisplay->channels[i]->repaint();
+            }
+        }  
+        setSelectedType((ChannelType) idx, false);
     }
-	int idx = typeButtons.indexOf((UtilityButton*)b);
-	if ((idx >= 0) && (b->getToggleState()))
-	{
-		for (int i = 0; i < processor->getNumInputs(); i++)
-		{
-			if (lfpDisplay->channels[i]->getSelected())
-			{
-				lfpDisplay->channels[i]->deselect();
-				lfpDisplay->channels[i]->repaint();
-			}
-		}
-		setSelectedType((channelType)idx,false);
-	}
 
 }
 
@@ -425,126 +426,126 @@ void LfpDisplayCanvas::comboBoxChanged(ComboBox* cb)
 
     if (cb == timebaseSelection)
     {
-		if (cb->getSelectedId())
-		{
-			timebase = timebases[cb->getSelectedId()-1].getFloatValue();
-		}
-		else
-		{
-			timebase = cb->getText().getFloatValue();
-			if (timebase)
-			{
-				if (timebase < timebases[0].getFloatValue())
-				{
-					cb->setSelectedId(1,dontSendNotification);
-					timebase = timebases[0].getFloatValue();
-				}
-				else if (timebase > timebases[timebases.size()-1].getFloatValue())
-				{
-					cb->setSelectedId(timebases.size(),dontSendNotification);
-					timebase = timebases[timebases.size()-1].getFloatValue();
-				}
-				else
-					cb->setText(String(timebase,1),dontSendNotification);
-			}
-			else
-			{
-				if (selectedSpread == 0)
-				{
-					cb->setText(selectedTimebaseValue,dontSendNotification);
-					timebase = selectedTimebaseValue.getFloatValue();
-				}
-				else
-				{
-					cb->setSelectedId(selectedTimebase,dontSendNotification);
-					timebase = timebases[selectedTimebase-1].getFloatValue();
-				}
-
-			}
-		}
+        if (cb->getSelectedId())
+        {
+            timebase = timebases[cb->getSelectedId()-1].getFloatValue();
+        }
+        else
+        {
+            timebase = cb->getText().getFloatValue();
+            if (timebase)
+            {
+                if (timebase < timebases[0].getFloatValue())
+                {
+                    cb->setSelectedId(1,dontSendNotification);
+                    timebase = timebases[0].getFloatValue();
+                }
+                else if (timebase > timebases[timebases.size()-1].getFloatValue())
+                {
+                    cb->setSelectedId(timebases.size(),dontSendNotification);
+                    timebase = timebases[timebases.size()-1].getFloatValue();
+                }
+                else
+                    cb->setText(String(timebase,1),dontSendNotification);
+            }
+            else
+            {
+                if (selectedSpread == 0)
+                {
+                    cb->setText(selectedTimebaseValue,dontSendNotification);
+                    timebase = selectedTimebaseValue.getFloatValue();
+                }
+                else
+                {
+                    cb->setSelectedId(selectedTimebase,dontSendNotification);
+                    timebase = timebases[selectedTimebase-1].getFloatValue();
+                }
+
+            }
+        }
     }
     else if (cb == rangeSelection)
     {
-		if (cb->getSelectedId())
-		{
-		lfpDisplay->setRange(voltageRanges[selectedChannelType][cb->getSelectedId()-1].getFloatValue()*rangeGain[selectedChannelType]
-			,selectedChannelType);
-		}
-		else
-		{
-		    float vRange = cb->getText().getFloatValue();
-		    if (vRange)
-		    {
-		        if (vRange < voltageRanges[selectedChannelType][0].getFloatValue())
-		        {
-					cb->setSelectedId(1,dontSendNotification);
-					vRange = voltageRanges[selectedChannelType][0].getFloatValue();
-		        }
-		        else if (vRange > voltageRanges[selectedChannelType][voltageRanges[selectedChannelType].size()-1].getFloatValue())
-		        {
-					cb->setSelectedId(voltageRanges[selectedChannelType].size(),dontSendNotification);
-					vRange = voltageRanges[selectedChannelType][voltageRanges[selectedChannelType].size()-1].getFloatValue();
-		        }
-		        else
-		        {
-		            if (rangeGain[selectedChannelType] > 1)
-		                cb->setText(String(vRange,1),dontSendNotification);
-		            else
-		                cb->setText(String(vRange),dontSendNotification);
-		        }
-				lfpDisplay->setRange(vRange*rangeGain[selectedChannelType],selectedChannelType);
-		    }
-		    else
-			{
-				if (selectedVoltageRange[selectedChannelType])
-					cb->setText(selectedVoltageRangeValues[selectedChannelType],dontSendNotification);
-				else
-					cb->setSelectedId(selectedVoltageRange[selectedChannelType],dontSendNotification);
-			}
-		}
-		selectedVoltageRange[selectedChannelType] = cb->getSelectedId();
-		selectedVoltageRangeValues[selectedChannelType] = cb->getText();
+        if (cb->getSelectedId())
+        {
+        lfpDisplay->setRange(voltageRanges[selectedChannelType][cb->getSelectedId()-1].getFloatValue()*rangeGain[selectedChannelType]
+            ,selectedChannelType);
+        }
+        else
+        {
+            float vRange = cb->getText().getFloatValue();
+            if (vRange)
+            {
+                if (vRange < voltageRanges[selectedChannelType][0].getFloatValue())
+                {
+                    cb->setSelectedId(1,dontSendNotification);
+                    vRange = voltageRanges[selectedChannelType][0].getFloatValue();
+                }
+                else if (vRange > voltageRanges[selectedChannelType][voltageRanges[selectedChannelType].size()-1].getFloatValue())
+                {
+                    cb->setSelectedId(voltageRanges[selectedChannelType].size(),dontSendNotification);
+                    vRange = voltageRanges[selectedChannelType][voltageRanges[selectedChannelType].size()-1].getFloatValue();
+                }
+                else
+                {
+                    if (rangeGain[selectedChannelType] > 1)
+                        cb->setText(String(vRange,1),dontSendNotification);
+                    else
+                        cb->setText(String(vRange),dontSendNotification);
+                }
+                lfpDisplay->setRange(vRange*rangeGain[selectedChannelType],selectedChannelType);
+            }
+            else
+            {
+                if (selectedVoltageRange[selectedChannelType])
+                    cb->setText(selectedVoltageRangeValues[selectedChannelType],dontSendNotification);
+                else
+                    cb->setSelectedId(selectedVoltageRange[selectedChannelType],dontSendNotification);
+            }
+        }
+        selectedVoltageRange[selectedChannelType] = cb->getSelectedId();
+        selectedVoltageRangeValues[selectedChannelType] = cb->getText();
         //std::cout << "Setting range to " << voltageRanges[cb->getSelectedId()-1].getFloatValue() << std::endl;
     }
     else if (cb == spreadSelection)
     {
-		if (cb->getSelectedId())
-		{
-			lfpDisplay->setChannelHeight(spreads[cb->getSelectedId()-1].getIntValue());
-			resized();
-		}
-		else
-		{
-			int spread = cb->getText().getIntValue();
-			if (spread)
-			{
-				if (spread < spreads[0].getFloatValue())
-				{
-					cb->setSelectedId(1,dontSendNotification);
-					spread = spreads[0].getFloatValue();
-				}
-				else if (spread > spreads[spreads.size()-1].getFloatValue())
-				{
-					cb->setSelectedId(spreads.size(),dontSendNotification);
-					spread = spreads[spreads.size()-1].getFloatValue();
-				}
-				else
-				{
-					cb->setText(String(spread),dontSendNotification);
-				}
-				lfpDisplay->setChannelHeight(spread);
-				resized();
-			}
-			else
-			{
-				if (selectedSpread == 0)
-					cb->setText(selectedSpreadValue,dontSendNotification);
-				else
-					cb->setSelectedId(selectedSpread,dontSendNotification);
-			}
-		}
-		selectedSpread = cb->getSelectedId();
-		selectedSpreadValue = cb->getText();
+        if (cb->getSelectedId())
+        {
+            lfpDisplay->setChannelHeight(spreads[cb->getSelectedId()-1].getIntValue());
+            resized();
+        }
+        else
+        {
+            int spread = cb->getText().getIntValue();
+            if (spread)
+            {
+                if (spread < spreads[0].getFloatValue())
+                {
+                    cb->setSelectedId(1,dontSendNotification);
+                    spread = spreads[0].getFloatValue();
+                }
+                else if (spread > spreads[spreads.size()-1].getFloatValue())
+                {
+                    cb->setSelectedId(spreads.size(),dontSendNotification);
+                    spread = spreads[spreads.size()-1].getFloatValue();
+                }
+                else
+                {
+                    cb->setText(String(spread),dontSendNotification);
+                }
+                lfpDisplay->setChannelHeight(spread);
+                resized();
+            }
+            else
+            {
+                if (selectedSpread == 0)
+                    cb->setText(selectedSpreadValue,dontSendNotification);
+                else
+                    cb->setSelectedId(selectedSpread,dontSendNotification);
+            }
+        }
+        selectedSpread = cb->getSelectedId();
+        selectedSpreadValue = cb->getText();
         //std::cout << "Setting spread to " << spreads[cb->getSelectedId()-1].getFloatValue() << std::endl;
     }
     else if (cb == colorGroupingSelection)
@@ -582,19 +583,19 @@ void LfpDisplayCanvas::setParameter(int param, float val)
 
 void LfpDisplayCanvas:: setRangeSelection(float range, bool canvasMustUpdate)
 {
-	if (canvasMustUpdate)
-	{
-		rangeSelection->setText(String(range/rangeGain[selectedChannelType]), sendNotification); 
-	}
-	else
-	{
-		rangeSelection->setText(String(range/rangeGain[selectedChannelType]),dontSendNotification);
-		selectedVoltageRange[selectedChannelType]=rangeSelection->getSelectedId();
-		selectedVoltageRangeValues[selectedChannelType]=rangeSelection->getText();
+    if (canvasMustUpdate)
+    {
+        rangeSelection->setText(String(range/rangeGain[selectedChannelType]), sendNotification); 
+    }
+    else
+    {
+        rangeSelection->setText(String(range/rangeGain[selectedChannelType]),dontSendNotification);
+        selectedVoltageRange[selectedChannelType]=rangeSelection->getSelectedId();
+        selectedVoltageRangeValues[selectedChannelType]=rangeSelection->getText();
 
-		repaint();
-		refresh();
-	}
+        repaint();
+        refresh();
+    }
 
 }
 
@@ -683,7 +684,6 @@ void LfpDisplayCanvas::updateScreenBuffer()
             nSamples = (displayBufferSize - dbi) + index;
         }
 
-
         float ratio = sampleRate[channel] * timebase / float(getWidth() - leftmargin - scrollBarThickness); // samples / pixel
         // this number is crucial: converting from samples to values (in px) for the screen buffer
         int valuesNeeded = (int) float(nSamples) / ratio; // N pixels needed for this update
@@ -748,51 +748,29 @@ void LfpDisplayCanvas::updateScreenBuffer()
                     
                     for (int j = dbi; j < nextpix; j++)
                     {
-                        // interpolate between two samples with invAlpha and alpha
-                        screenBuffer->addFrom(channel, // destChannel
-                                              screenBufferIndex, // destStartSample
-                                              displayBuffer->getReadPointer(channel, displayBufferIndex), // source
-                                              1, // numSamples
-                                              invAlpha*gain); // gain
-
-
-                        screenBuffer->addFrom(channel, // destChannel
-                                              screenBufferIndex, // destStartSample
-                                              displayBuffer->getReadPointer(channel, nextPos), // source
-                                              1, // numSamples
-                                              alpha*gain); // gain
-
-                        // same thing again, but this time add the min,mean, and max of all samples in current pixel
-                        float sample_min   =  1000000;
-                        float sample_max   = -1000000;
-                        float sample_mean  =  0;
-                        int c=0;
-                        int nextpix = (displayBufferIndex +(int)ratio) % displayBufferSize; //  position to next pixels index
-                        for (int j = displayBufferIndex; j < nextpix; j++)
-                        {
-                            float sample_current = displayBuffer->getSample(channel, j);
-                            sample_mean = sample_mean + sample_current;
+                        float sample_current = displayBuffer->getSample(channel, j);
+                        sample_mean = sample_mean + sample_current;
 
-                            if (sample_min>sample_current)
-                            {
-                                sample_min=sample_current;
-                            }
-
-                            if (sample_max<sample_current)
-                            {
-                                sample_max=sample_current;
-                            }
-                            c++;
+                        if (sample_min>sample_current)
+                        {
+                            sample_min=sample_current;
+                        }
 
+                        if (sample_max<sample_current)
+                        {
+                            sample_max=sample_current;
                         }
+                        c++;
+
+                    }
 
-                        sample_mean = sample_mean/c;
-                        screenBufferMean->addSample(channel, sbi, sample_mean*gain);
-                        screenBufferMin->addSample(channel, sbi, sample_min*gain);
-                        screenBufferMax->addSample(channel, sbi, sample_max*gain);
+                    sample_mean = sample_mean/c;
+                    screenBufferMean->addSample(channel, sbi, sample_mean*gain);
+                    screenBufferMin->addSample(channel, sbi, sample_min*gain);
+                    screenBufferMax->addSample(channel, sbi, sample_max*gain);
                 
 
-                    sbi++;
+                sbi++;
                 }
             
 
@@ -892,12 +870,12 @@ void LfpDisplayCanvas::paint(Graphics& g)
 
     g.setColour(Colour(100,100,100));
 
-	g.drawText("Voltage range ("+ rangeUnits[selectedChannelType] +")",5,getHeight()-55,300,20,Justification::left, false);
+    g.drawText("Voltage range ("+ rangeUnits[selectedChannelType] +")",5,getHeight()-55,300,20,Justification::left, false);
     g.drawText("Timebase (s)",175,getHeight()-55,300,20,Justification::left, false);
     g.drawText("Spread (px)",345,getHeight()-55,300,20,Justification::left, false);
     g.drawText("Color grouping",620,getHeight()-55,300,20,Justification::left, false);
 
-//	g.drawText(typeNames[selectedChannelType],110,getHeight()-30,50,20,Justification::centredLeft,false);
+    //g.drawText(typeNames[selectedChannelType],110,getHeight()-30,50,20,Justification::centredLeft,false);
 
     g.drawText("Event disp.",500,getHeight()-55,300,20,Justification::left, false);
 
@@ -942,8 +920,8 @@ void LfpDisplayCanvas::saveVisualizerParameters(XmlElement* xml)
     XmlElement* xmlNode = xml->createNewChildElement("LFPDISPLAY");
 
 
-	xmlNode->setAttribute("Range",selectedVoltageRangeValues[0]+","+selectedVoltageRangeValues[1]+
-		","+selectedVoltageRangeValues[2]);
+    xmlNode->setAttribute("Range",selectedVoltageRangeValues[0]+","+selectedVoltageRangeValues[1]+
+        ","+selectedVoltageRangeValues[2]);
     xmlNode->setAttribute("Timebase",timebaseSelection->getText());
     xmlNode->setAttribute("Spread",spreadSelection->getText());
     xmlNode->setAttribute("colorGrouping",colorGroupingSelection->getSelectedId());
@@ -989,15 +967,15 @@ void LfpDisplayCanvas::loadVisualizerParameters(XmlElement* xml)
     {
         if (xmlNode->hasTagName("LFPDISPLAY"))
         {
-			StringArray ranges;
-			ranges.addTokens(xmlNode->getStringAttribute("Range"),",",String::empty);
-			selectedVoltageRangeValues[0] = ranges[0];
-			selectedVoltageRangeValues[1] = ranges[1];
-			selectedVoltageRangeValues[2] = ranges[2];
-			selectedVoltageRange[0] = voltageRanges[0].indexOf(ranges[0])+1;
-			selectedVoltageRange[1] = voltageRanges[1].indexOf(ranges[1])+1;
-			selectedVoltageRange[2] = voltageRanges[2].indexOf(ranges[2])+1;
-			rangeSelection->setText(ranges[0]);
+            StringArray ranges;
+            ranges.addTokens(xmlNode->getStringAttribute("Range"),",",String::empty);
+            selectedVoltageRangeValues[0] = ranges[0];
+            selectedVoltageRangeValues[1] = ranges[1];
+            selectedVoltageRangeValues[2] = ranges[2];
+            selectedVoltageRange[0] = voltageRanges[0].indexOf(ranges[0])+1;
+            selectedVoltageRange[1] = voltageRanges[1].indexOf(ranges[1])+1;
+            selectedVoltageRange[2] = voltageRanges[2].indexOf(ranges[2])+1;
+            rangeSelection->setText(ranges[0]);
 
             timebaseSelection->setText(xmlNode->getStringAttribute("Timebase"));
             spreadSelection->setText(xmlNode->getStringAttribute("Spread"));
@@ -1053,41 +1031,40 @@ void LfpDisplayCanvas::loadVisualizerParameters(XmlElement* xml)
 
 ChannelType LfpDisplayCanvas::getChannelType(int n)
 {
-	if (n < processor->channels.size())
-		return processor->channels[n]->getType();
-	else
-		return DATA_CHANNEL;
+    return processor->channels[n]->getType();
 }
 
 ChannelType LfpDisplayCanvas::getSelectedType()
 {
-	return selectedChannelType;
+    return selectedChannelType;
 }
 
-void LfpDisplayCanvas::setSelectedType(channelType type, bool toggleButton)
+void LfpDisplayCanvas::setSelectedType(ChannelType type, bool toggleButton)
 {
-	if (selectedChannelType == type)
-		return; //Nothing to do here
-	selectedChannelType = type;
-	rangeSelection->clear(dontSendNotification);
-	rangeSelection->addItemList(voltageRanges[type],1);
-	int id = selectedVoltageRange[type];
-	if (id)
-		rangeSelection->setSelectedId(id,sendNotification);
-	else
-		rangeSelection->setText(selectedVoltageRangeValues[selectedChannelType],dontSendNotification);
-	if (toggleButton)
-		typeButtons[type]->setToggleState(true,dontSendNotification);
+    if (selectedChannelType == type)
+        return; //Nothing to do here
+    selectedChannelType = type;
+    rangeSelection->clear(dontSendNotification);
+    rangeSelection->addItemList(voltageRanges[type],1);
+    int id = selectedVoltageRange[type];
+    if (id)
+        rangeSelection->setSelectedId(id,sendNotification);
+    else
+        rangeSelection->setText(selectedVoltageRangeValues[selectedChannelType],dontSendNotification);
+    repaint(5,getHeight()-55,300,100);
+
+    if (toggleButton)
+        typeButtons[type]->setToggleState(true,dontSendNotification);
 }
 
 String LfpDisplayCanvas::getTypeName(ChannelType type)
 {
-	return typeNames[type];
+    return typeNames[type];
 }
 
 int LfpDisplayCanvas::getRangeStep(ChannelType type)
 {
-	return rangeSteps[type];
+    return rangeSteps[type];
 }
 
 // -------------------------------------------------------------
@@ -1152,9 +1129,9 @@ LfpDisplay::LfpDisplay(LfpDisplayCanvas* c, Viewport* v) :
     totalHeight = 0;
     colorGrouping=1;
 
-	range[0] = 1000;
-	range[1] = 500;
-	range[2] = 500000;
+    range[0] = 1000;
+    range[1] = 500;
+    range[2] = 500000;
 
     addMouseListener(this, true);
 
@@ -1232,7 +1209,7 @@ void LfpDisplay::setNumChannels(int numChannels)
         LfpChannelDisplay* lfpChan = new LfpChannelDisplay(canvas, this, i);
 
         //lfpChan->setColour(channelColours[i % channelColours.size()]);
-		lfpChan->setRange(range[canvas->getChannelType(i)]);
+        lfpChan->setRange(range[canvas->getChannelType(i)]);
         lfpChan->setChannelHeight(canvas->getChannelHeight());
 
         addAndMakeVisible(lfpChan);
@@ -1249,8 +1226,6 @@ void LfpDisplay::setNumChannels(int numChannels)
 
         channelInfo.add(lfpInfo);
 
-		savedChannelState.add(true);
-
         totalHeight += lfpChan->getChannelHeight();
 
     }
@@ -1365,24 +1340,24 @@ void LfpDisplay::setRange(float r, ChannelType type)
 
     for (int i = 0; i < numChans; i++)
     {
-		if (channels[i]->getType() == type)
-			channels[i]->setRange(range[type]);
+        if (channels[i]->getType() == type)
+            channels[i]->setRange(range[type]);
     }
     canvas->fullredraw = true; //issue full redraw
 }
 
 int LfpDisplay::getRange()
 {
-	return getRange(canvas->getSelectedType());
+    return getRange(canvas->getSelectedType());
 }
 
 int LfpDisplay::getRange(ChannelType type)
 {
-	for (int i=0; i < numChans; i++)
-	{
-		if (channels[i]->getType() == type)
-			return channels[i]->getRange();
-	}
+    for (int i=0; i < numChans; i++)
+    {
+        if (channels[i]->getType() == type)
+            return channels[i]->getRange();
+    }
 }
 
 
@@ -1402,7 +1377,7 @@ void LfpDisplay::setChannelHeight(int r, bool resetSingle)
         singleChan = -1;
         for (int n = 0; n < numChans; n++)
         {
-			channelInfo[n]->setEnabledState(savedChannelState[n]);
+            channelInfo[n]->setEnabledState(true);
         }
     }
 
@@ -1444,8 +1419,8 @@ void LfpDisplay::mouseWheelMove(const MouseEvent&  e, const MouseWheelDetails&
 {
 
     //std::cout << "Mouse wheel " <<  e.mods.isCommandDown() << "  " << wheel.deltaY << std::endl;
-	//TODO Changing ranges with the wheel is currently broken. With multiple ranges, most
-	//of the wheel range code needs updating
+    //TODO Changing ranges with the wheel is currently broken. With multiple ranges, most
+    //of the wheel range code needs updating
     if (e.mods.isCommandDown())  // CTRL + scroll wheel -> change channel spacing
     {
         int h = getChannelHeight();
@@ -1484,18 +1459,18 @@ void LfpDisplay::mouseWheelMove(const MouseEvent&  e, const MouseWheelDetails&
         if (e.mods.isShiftDown())  // SHIFT + scroll wheel -> change channel range
         {
             int h = getRange();
-			int step = canvas->getRangeStep(canvas->getSelectedType());
+            int step = canvas->getRangeStep(canvas->getSelectedType());
             
             std::cout << wheel.deltaY << std::endl;
             
             if (wheel.deltaY > 0)
             {
-				setRange(h+step,canvas->getSelectedType());
+                setRange(h+step,canvas->getSelectedType());
             }
             else
             {
                 if (h > step+1)
-					setRange(h-step,canvas->getSelectedType());
+                    setRange(h-step,canvas->getSelectedType());
             }
 
             canvas->setRangeSelection(h); // update combobox
@@ -1523,14 +1498,12 @@ void LfpDisplay::toggleSingleChannel(int chan)
     {
         singleChan = chan;
         int newHeight = viewport->getHeight();
-		channelInfo[chan]->setEnabledState(true);
         setChannelHeight(newHeight, false);
         setSize(getWidth(), numChans*getChannelHeight());
         viewport->setScrollBarsShown(false,false);
         viewport->setViewPosition(Point<int>(0,chan*newHeight));
         for (int n = 0; n < numChans; n++)
         {
-			savedChannelState.set(n,channels[n]->getEnabledState());
             if (n != chan) channelInfo[n]->setEnabledState(false);
         }
 
@@ -1577,7 +1550,7 @@ void LfpDisplay::mouseDown(const MouseEvent& event)
     //lcd->select();
 
     channels[closest]->select();
-	canvas->setSelectedType(channels[closest]->getType());
+    canvas->setSelectedType(channels[closest]->getType());
 
     if (event.getNumberOfClicks() == 2)
         toggleSingleChannel(closest);
@@ -1650,8 +1623,8 @@ LfpChannelDisplay::LfpChannelDisplay(LfpDisplayCanvas* c, LfpDisplay* d, int cha
 
     lineColour = Colour(255,255,255);
 
-	type = c->getChannelType(channelNumber);
-	typeStr = c->getTypeName(type);
+    type = c->getChannelType(channelNumber);
+    typeStr = c->getTypeName(type);
 
 }
 
@@ -1662,8 +1635,8 @@ LfpChannelDisplay::~LfpChannelDisplay()
 
 void LfpChannelDisplay::updateType()
 {
-	type = canvas->getChannelType(chan);
-	typeStr = canvas->getTypeName(type);
+    type = canvas->getChannelType(chan);
+    typeStr = canvas->getTypeName(type);
 }
 
 void LfpChannelDisplay::setEnabledState(bool state)
@@ -1724,7 +1697,7 @@ void LfpChannelDisplay::paint(Graphics& g)
 
             int leftEdge = 150;
 
-			float r = range;
+            float r = range;
 
             g.setColour(Colours::lightgrey);
             g.setFont(channelFont);
@@ -1732,10 +1705,10 @@ void LfpChannelDisplay::paint(Graphics& g)
             String unitString;
             if (getType() == ADC_CHANNEL)
             {
-            	unitString = " V";
-				//r = range / 1000.0f;
+                unitString = " V";
+                //r = range / 1000.0f;
             } else {
-            	unitString = " uV";
+                unitString = " uV";
             }
             g.drawText(String(0) + unitString, 20, center, leftEdge, 25, Justification::left, false);
             g.drawText(String(r/2) + unitString, 20, center-channelHeight/2, leftEdge, 25, Justification::left, false);
@@ -1866,7 +1839,7 @@ void LfpChannelDisplay::paint(Graphics& g)
 
 void LfpChannelDisplay::setRange(float r)
 {
-	
+    
     range = r;
 
     //std::cout << "Range: " << r << std::endl;
@@ -1890,7 +1863,7 @@ void LfpChannelDisplay::deselect()
 
 bool LfpChannelDisplay::getSelected()
 {
-	return isSelected;
+   return isSelected;
 }
 
 void LfpChannelDisplay::setColour(Colour c)
@@ -1957,7 +1930,7 @@ void LfpChannelDisplay::setName(String name_)
 
 ChannelType LfpChannelDisplay::getType()
 {
-	return type;
+    return type;
 }
 
 // -------------------------------
@@ -1983,9 +1956,9 @@ LfpChannelDisplayInfo::LfpChannelDisplayInfo(LfpDisplayCanvas* canvas_, LfpDispl
 
 void LfpChannelDisplayInfo::updateType()
 {
-	type = canvas->getChannelType(chan);
-	typeStr = canvas->getTypeName(type);
-	repaint();
+    type = canvas->getChannelType(chan);
+    typeStr = canvas->getTypeName(type);
+    repaint();
 }
 
 void LfpChannelDisplayInfo::buttonClicked(Button* button)
@@ -2021,12 +1994,12 @@ void LfpChannelDisplayInfo::paint(Graphics& g)
     g.setColour(lineColour);
 
     //if (chan > 98)
-    //	g.fillRoundedRectangle(5,center-8,51,22,8.0f);
+    //  g.fillRoundedRectangle(5,center-8,51,22,8.0f);
     //else
     g.fillRoundedRectangle(5,center-8,41,22,8.0f);
 
       g.setFont(Font("Small Text", 13, Font::plain));
-	  g.drawText(typeStr,5,center+16,41,10,Justification::centred,false);
+      g.drawText(typeStr,5,center+16,41,10,Justification::centred,false);
     // g.setFont(channelHeightFloat*0.3);
 
     //  g.drawText(name, 10, center-channelHeight/2, 200, channelHeight, Justification::left, false);
@@ -2039,7 +2012,7 @@ void LfpChannelDisplayInfo::resized()
     int center = getHeight()/2;
 
     //if (chan > 98)
-    //	enableButton->setBounds(8,center-5,45,16);
+    //  enableButton->setBounds(8,center-5,45,16);
     //else
     enableButton->setBounds(8,center-5,35,16);
 }
@@ -2115,13 +2088,13 @@ void EventDisplayInterface::paint(Graphics& g)
 // Lfp Viewport -------------------------------------------
 
 LfpViewport::LfpViewport(LfpDisplayCanvas *canvas)
-	: Viewport()
+    : Viewport()
 {
-	this->canvas = canvas;
+    this->canvas = canvas;
 }
 
 void LfpViewport::visibleAreaChanged(const Rectangle<int>& newVisibleArea)
 {
-	canvas->fullredraw = true;
-	canvas->refresh();
+    canvas->fullredraw = true;
+    canvas->refresh();
 }
diff --git a/Source/Processors/LfpDisplayNode/LfpDisplayCanvas.h b/Source/Processors/LfpDisplayNode/LfpDisplayCanvas.h
index 14e188e6096dcfd311ff78e7dff45b5703732c03..d814232a6e3e6fc2695e7605c01e6a2b40ad12fe 100755
--- a/Source/Processors/LfpDisplayNode/LfpDisplayCanvas.h
+++ b/Source/Processors/LfpDisplayNode/LfpDisplayCanvas.h
@@ -64,8 +64,8 @@ public:
     void setParameter(int, float);
     void setParameter(int, int, int, float) {}
 
-	void setRangeSelection(float range, bool canvasMustUpdate = false); // set range selection combo box to correct value if it has been changed by scolling etc.
-	void setSpreadSelection(int spread, bool canvasMustUpdate = false); // set spread selection combo box to correct value if it has been changed by scolling etc.
+    void setRangeSelection(float range, bool canvasMustUpdate = false); // set range selection combo box to correct value if it has been changed by scolling etc.
+    void setSpreadSelection(int spread, bool canvasMustUpdate = false); // set spread selection combo box to correct value if it has been changed by scolling etc.
 
     void paint(Graphics& g);
 
@@ -98,12 +98,12 @@ public:
     bool keyPressed(const KeyPress& key);
     bool keyPressed(const KeyPress& key, Component* orig);
 
-	ChannelType getChannelType(int n);
-	ChannelType getSelectedType();
-	String getTypeName(ChannelType type);
-	int getRangeStep(ChannelType type);
+    ChannelType getChannelType(int n);
+    ChannelType getSelectedType();
+    String getTypeName(ChannelType type);
+    int getRangeStep(ChannelType type);
 
-	void setSelectedType(channelType type, bool toggleButton = true);
+    void setSelectedType(ChannelType type, bool toggleButton = true);
 
     //void scrollBarMoved(ScrollBar *scrollBarThatHasMoved, double newRangeStart);
 
@@ -112,7 +112,7 @@ public:
 
     Array<bool> isChannelEnabled;
 
-	int nChans;
+    int nChans;
 
 private:
 
@@ -123,7 +123,7 @@ private:
     //int spread ; // vertical spacing between channels
 
 
-    static const int MAX_N_CHAN = 1028;  // maximum number of channels
+    static const int MAX_N_CHAN = 2048;  // maximum number of channels
     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
 
@@ -150,26 +150,26 @@ private:
     ScopedPointer<UtilityButton> invertInputButton;
     ScopedPointer<UtilityButton> drawMethodButton;
     ScopedPointer<UtilityButton> pauseButton;
-	OwnedArray<UtilityButton> typeButtons;
+    OwnedArray<UtilityButton> typeButtons;
 
     StringArray voltageRanges[CHANNEL_TYPES];
     StringArray timebases;
     StringArray spreads; // option for vertical spacing between channels
     StringArray colorGroupings; // option for coloring every N channels the same
 
-	ChannelType selectedChannelType;
-	int selectedVoltageRange[CHANNEL_TYPES];
-	String selectedVoltageRangeValues[CHANNEL_TYPES];
-	float rangeGain[CHANNEL_TYPES];
-	StringArray rangeUnits;
-	StringArray typeNames;
-	int rangeSteps[CHANNEL_TYPES];
+    ChannelType selectedChannelType;
+    int selectedVoltageRange[CHANNEL_TYPES];
+    String selectedVoltageRangeValues[CHANNEL_TYPES];
+    float rangeGain[CHANNEL_TYPES];
+    StringArray rangeUnits;
+    StringArray typeNames;
+    int rangeSteps[CHANNEL_TYPES];
 
-	int selectedSpread;
-	String selectedSpreadValue;
+    int selectedSpread;
+    String selectedSpreadValue;
 
-	int selectedTimebase;
-	String selectedTimebaseValue;
+    int selectedTimebase;
+    String selectedTimebaseValue;
 
     OwnedArray<EventDisplayInterface> eventDisplayInterfaces;
 
@@ -179,7 +179,7 @@ private:
     Array<int> displayBufferIndex;
     int displayBufferSize;
 
-	int scrollBarThickness;
+    int scrollBarThickness;
 
     JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(LfpDisplayCanvas);
 
@@ -229,10 +229,10 @@ public:
 
 
     void setRange(float range, ChannelType type);
-	
-	//Withouth parameters returns selected type
+    
+    //Withouth parameters returns selected type
     int getRange();
-	int getRange(ChannelType type);
+    int getRange(ChannelType type);
 
     void setChannelHeight(int r, bool resetSingle = true);
     int getChannelHeight();
@@ -251,7 +251,7 @@ public:
     bool getEnabledState(int);
     void enableChannel(bool, int);
 
-	bool getSingleChannelState();
+    bool getSingleChannelState();
 
     Array<Colour> channelColours;
 
@@ -262,9 +262,8 @@ public:
     bool isPaused; // simple pause function, skips screen bufer updates
 
 private:
-	void toggleSingleChannel(int chan);
-	int singleChan;
-	Array<bool> savedChannelState;
+    void toggleSingleChannel(int chan);
+    int singleChan;
 
     int numChans;
 
@@ -290,7 +289,8 @@ public:
 
     void select();
     void deselect();
-	bool getSelected();
+
+    bool getSelected();
 
     void setName(String);
 
@@ -316,8 +316,8 @@ public:
         return isEnabled;
     }
 
-	ChannelType getType();
-	void updateType();
+    ChannelType getType();
+    void updateType();
 
     bool fullredraw; // used to indicate that a full redraw is required. is set false after each full redraw
 
@@ -347,8 +347,8 @@ protected:
     bool canBeInverted;
     bool drawMethod;
 
-	ChannelType type;
-	String typeStr;
+    ChannelType type;
+    String typeStr;
 
 };
 
@@ -365,7 +365,7 @@ public:
     void resized();
 
     void setEnabledState(bool);
-	void updateType();
+    void updateType();
 
 private:
 
@@ -402,11 +402,11 @@ private:
 class LfpViewport : public Viewport
 {
 public:
-	LfpViewport(LfpDisplayCanvas* canvas);
-	void visibleAreaChanged(const Rectangle<int>& newVisibleArea);
+    LfpViewport(LfpDisplayCanvas* canvas);
+    void visibleAreaChanged(const Rectangle<int>& newVisibleArea);
 
 private:
-	LfpDisplayCanvas* canvas;
+    LfpDisplayCanvas* canvas;
 };
 
 
diff --git a/Source/Processors/NetworkEvents/NetworkEvents.cpp b/Source/Processors/NetworkEvents/NetworkEvents.cpp
index ba1e1c09ae2cd65d99ecb47df43f83e2b4309de9..0e04c91e22887ddab7fe685dd48fe76749c61f64 100644
--- a/Source/Processors/NetworkEvents/NetworkEvents.cpp
+++ b/Source/Processors/NetworkEvents/NetworkEvents.cpp
@@ -269,7 +269,7 @@ void NetworkEvents::postTimestamppedStringToMidiBuffer(StringTS s, MidiBuffer& e
 			 (uint8) NETWORK,
 			 0,
 			 0,
-			 (uint8) GENERIC_EVENT,
+			 0,
 			 (uint8) s.len+8,
 			 msg_with_ts);
 
@@ -380,8 +380,7 @@ String NetworkEvents::handleSpecialMessages(StringTS msg)
 }
 
 void NetworkEvents::process(AudioSampleBuffer& buffer,
-							MidiBuffer& events,
-							int& nSamples)
+							MidiBuffer& events)
 {
 
 	//std::cout << "NETWORK NODE" << std::endl;
@@ -399,8 +398,7 @@ void NetworkEvents::process(AudioSampleBuffer& buffer,
 		     networkMessagesQueue.pop();
 	 }
 	 lock.exit();
-	 nSamples = -10; // make sure this is not processed;
-	//printf("Exitting NetworkEvents::process\n");	
+
 }
 
 
diff --git a/Source/Processors/NetworkEvents/NetworkEvents.h b/Source/Processors/NetworkEvents/NetworkEvents.h
index 6dc9c4ac0cf8cd855c4d04fdd2e2f52f42a8e06f..0609d5d1bfaf93469d24b6933f10a297672e73b0 100644
--- a/Source/Processors/NetworkEvents/NetworkEvents.h
+++ b/Source/Processors/NetworkEvents/NetworkEvents.h
@@ -74,7 +74,7 @@ public:
 	int64 getExtrapolatedHardwareTimestamp(int64 softwareTS);
 	void initSimulation();
 	void simulateDesignAndTrials(juce::MidiBuffer& events);
-    void process(AudioSampleBuffer& buffer, MidiBuffer& midiMessages, int& nSamples);
+    void process(AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
     void setParameter(int parameterIndex, float newValue);
 	String handleSpecialMessages(StringTS msg);
 	std::vector<String> splitString(String S, char sep);
diff --git a/Source/Processors/PSTH/PeriStimulusTimeHistogramNode.cpp b/Source/Processors/PSTH/PeriStimulusTimeHistogramNode.cpp
index 9fa3ecda7a50c086c5f7c7a56acc0932da381a96..69f2ad42b61a2e70ca25196d3856acfde555114b 100644
--- a/Source/Processors/PSTH/PeriStimulusTimeHistogramNode.cpp
+++ b/Source/Processors/PSTH/PeriStimulusTimeHistogramNode.cpp
@@ -157,7 +157,7 @@ void PeriStimulusTimeHistogramNode::toggleConditionVisibility(int cond)
 	}
 }
 
-void PeriStimulusTimeHistogramNode::process(AudioSampleBuffer& buffer, MidiBuffer& events, int& nSamples)
+void PeriStimulusTimeHistogramNode::process(AudioSampleBuffer& buffer, MidiBuffer& events)
 {
 	//printf("Entering PeriStimulusTimeHistogramNode::process\n");
 	// Update internal statistics 
@@ -169,7 +169,7 @@ void PeriStimulusTimeHistogramNode::process(AudioSampleBuffer& buffer, MidiBuffe
 		syncInternalDataStructuresWithSpikeSorter();	
 	} else if (trialCircularBuffer != nullptr)
 	{
-		trialCircularBuffer->process(buffer,nSamples,hardware_timestamp,software_timestamp);
+		trialCircularBuffer->process(buffer,getNumSamples(0),hardware_timestamp,software_timestamp);
 	}
 
 
@@ -534,7 +534,7 @@ String PeriStimulusTimeHistogramNode::generateHeader()
     header += "header.bitVolts = ";
 	if (recordNode->channels.size() > 0)
 	{
-		header += String(recordNode->channels[0]->getChannelGain());
+		header += String(recordNode->channels[0]->bitVolts);
 	}
 	else
 	{
diff --git a/Source/Processors/PSTH/PeriStimulusTimeHistogramNode.h b/Source/Processors/PSTH/PeriStimulusTimeHistogramNode.h
index 72bd2e016825f4711dd5f70d1ffc1610e8cdfbae..fd94553d78f70ef6d032419cb0f0348a3af38007 100644
--- a/Source/Processors/PSTH/PeriStimulusTimeHistogramNode.h
+++ b/Source/Processors/PSTH/PeriStimulusTimeHistogramNode.h
@@ -57,7 +57,7 @@ public:
         return true;
     }
 
-    void process(AudioSampleBuffer& buffer, MidiBuffer& midiMessages, int& nSamples);
+    void process(AudioSampleBuffer& buffer, MidiBuffer& midiMessages);
 
     void syncInternalDataStructuresWithSpikeSorter();
 
diff --git a/Source/Processors/SourceNode/SourceNode.cpp b/Source/Processors/SourceNode/SourceNode.cpp
index 6952ef47f523fd5994f7e0ccc5759081b41a0ec6..6675ddc3e82917d3db226911a1edacb6d07bc14e 100755
--- a/Source/Processors/SourceNode/SourceNode.cpp
+++ b/Source/Processors/SourceNode/SourceNode.cpp
@@ -492,7 +492,7 @@ void SourceNode::saveCustomParametersToXml(XmlElement* parentElement)
 {
 
     StringArray names;
-    Array<channelType> types;
+    Array<ChannelType> types;
     Array<int> stream;
     Array<int> originalChannelNumber;
     Array<float> gains;
@@ -526,7 +526,7 @@ void SourceNode::loadCustomParametersFromXml()
 					String name = chan->getStringAttribute("name");
 					int stream = chan->getIntAttribute("stream");
 					int number = chan->getIntAttribute("number");
-					channelType type = static_cast<channelType>(chan->getIntAttribute("type"));
+					ChannelType type = static_cast<ChannelType>(chan->getIntAttribute("type"));
 					float gain = chan->getDoubleAttribute("gain");
 					modifyChannelName(type,stream,number,name,false);
 					modifyChannelGain(stream,number,type,gain,false);					
diff --git a/open-ephys.jucer b/open-ephys.jucer
index f61918da78ed03213a99cc55b1fc49e4609301f3..7df9d9419b2be167b0dd9cd9230eac631f44c8e5 100644
--- a/open-ephys.jucer
+++ b/open-ephys.jucer
@@ -568,15 +568,6 @@
           <FILE id="fDpocU" name="TrialCircularBuffer.h" compile="0" resource="0"
                 file="Source/Processors/PSTH/TrialCircularBuffer.h"/>
         </GROUP>
-        <GROUP id="{B0C14DBE-8CC1-F242-3534-1DFBEAC5E43B}" name="ReferenceNode">
-          <FILE id="F7WTBV" name="ReferenceNode.cpp" compile="1" resource="0"
-                file="Source/Processors/ReferenceNode/ReferenceNode.cpp"/>
-          <FILE id="XyYPUn" name="ReferenceNode.h" compile="0" resource="0" file="Source/Processors/ReferenceNode/ReferenceNode.h"/>
-          <FILE id="tsfK4e" name="ReferenceNodeEditor.cpp" compile="1" resource="0"
-                file="Source/Processors/ReferenceNode/ReferenceNodeEditor.cpp"/>
-          <FILE id="virGvM" name="ReferenceNodeEditor.h" compile="0" resource="0"
-                file="Source/Processors/ReferenceNode/ReferenceNodeEditor.h"/>
-        </GROUP>
         <GROUP id="{C6F1F354-C97E-128E-9C4E-2376E039F233}" name="ResamplingNode">
           <FILE id="yIwQ4b" name="ResamplingNode.cpp" compile="1" resource="0"
                 file="Source/Processors/ResamplingNode/ResamplingNode.cpp"/>