diff --git a/Builds/Linux/Makefile b/Builds/Linux/Makefile
index 3998a067c3418ac21b86beec90f57de8921f5b36..f3527e8da530377e24aa0099f5ab420fc4716627 100644
--- a/Builds/Linux/Makefile
+++ b/Builds/Linux/Makefile
@@ -17,12 +17,12 @@ ifeq ($(CONFIG),Debug)
   LIBDIR := build
   OBJDIR := build/intermediate/Debug
   OUTDIR := build
-  CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode
-  CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0
+  CPPFLAGS := $(DEPFLAGS) -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode
+  CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -O3
   CXXFLAGS += $(CFLAGS) -export-dynamic -g -pg
   LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -L/usr/X11R6/lib/ -lGL -lX11 -lXext -lXinerama -lasound -ldl -lfreetype -lpthread -lrt -lftdi -lftgl -pg -ldl -lXext
   LDDEPS :=
-  RESFLAGS :=  -D "LINUX=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode
+  RESFLAGS :=  -D "LINUX=1" -D "NDEBUG=1" -D "JUCER_LINUX_MAKE_7346DA2A=1" -I /usr/include -I /usr/include/freetype2 -I ../../JuceLibraryCode
   TARGET := open-ephys
   BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH)
 endif
diff --git a/Source/Processors/DataThreads/RHD2000Thread.cpp b/Source/Processors/DataThreads/RHD2000Thread.cpp
index 70c6d38b954edc8d8cad75009e3e7dc7c08e38b7..59172015c3c0b727a2c4d35a4ab10edc9a9c4395 100644
--- a/Source/Processors/DataThreads/RHD2000Thread.cpp
+++ b/Source/Processors/DataThreads/RHD2000Thread.cpp
@@ -24,7 +24,7 @@
 #include "RHD2000Thread.h"
 #include "../SourceNode.h"
 
-RHD2000Thread::RHD2000Thread(SourceNode* sn) : DataThread(sn)
+RHD2000Thread::RHD2000Thread(SourceNode* sn) : DataThread(sn), isTransmitting(false)
 {
     evalBoard = new Rhd2000EvalBoard;
     dataBlock = new Rhd2000DataBlock(1);
@@ -123,6 +123,10 @@ RHD2000Thread::~RHD2000Thread()
 
 }
 
+bool RHD2000Thread::isAcquisitionActive()
+{
+    return isTransmitting;
+}
 
 int RHD2000Thread::getNumChannels()
 {
@@ -159,7 +163,7 @@ bool RHD2000Thread::foundInputSource()
 
 }
 
-void RHD2000Thread::enableHeadstage(int hsNum, bool enabled)
+bool RHD2000Thread::enableHeadstage(int hsNum, bool enabled)
 {
     
     evalBoard->enableDataStream(hsNum, enabled);
@@ -179,6 +183,8 @@ void RHD2000Thread::enableHeadstage(int hsNum, bool enabled)
     std::cout << "Enabled data streams: " << evalBoard->getNumEnabledDataStreams() << std::endl;
 
     dataBuffer->resize(getNumChannels(), 10000);
+
+    return true;
 }
 
 bool RHD2000Thread::isHeadstageEnabled(int hsNum)
@@ -245,8 +251,7 @@ bool RHD2000Thread::startAcquisition()
     startThread();
 
 
-    // isTransmitting = true;
-    // accumulator = 0;
+    isTransmitting = true;
 
     return true;
 }
@@ -283,6 +288,8 @@ bool RHD2000Thread::stopAcquisition()
     int ledArray[8] = {1, 0, 0, 0, 0, 0, 0, 0};
     evalBoard->setLedDisplay(ledArray);
 
+    isTransmitting = false;
+
     return true;
 }
 
diff --git a/Source/Processors/DataThreads/RHD2000Thread.h b/Source/Processors/DataThreads/RHD2000Thread.h
index 14c8293bbde2bf3a1dee6abdeb6ffab2b746ec05..e1542d32e68b284c98083fb46b183fa17c74cd02 100644
--- a/Source/Processors/DataThreads/RHD2000Thread.h
+++ b/Source/Processors/DataThreads/RHD2000Thread.h
@@ -63,12 +63,14 @@ public:
 
     bool isHeadstageEnabled(int hsNum);
 
-    void enableHeadstage(int hsNum, bool enabled);
+    bool enableHeadstage(int hsNum, bool enabled);
     void setCableLength(int hsNum, float length);
     void setNumChannels(int hsNum, int nChannels);
 
     int getNumEventChannels();
 
+    bool isAcquisitionActive();
+
 private:
 
     ScopedPointer<Rhd2000EvalBoard> evalBoard;
@@ -84,6 +86,8 @@ private:
 
     int blockSize;
 
+    bool isTransmitting;
+
     bool startAcquisition();
     bool stopAcquisition();
 
diff --git a/Source/Processors/Editors/GenericEditor.cpp b/Source/Processors/Editors/GenericEditor.cpp
index 215ad007dfa8d14df5ae053fdc637fbbc7bbfd37..9e16de9ef133e8f7043a83978b702e4c5c0893c5 100755
--- a/Source/Processors/Editors/GenericEditor.cpp
+++ b/Source/Processors/Editors/GenericEditor.cpp
@@ -37,7 +37,7 @@ GenericEditor::GenericEditor(GenericProcessor* owner, bool useDefaultParameterEd
     : AudioProcessorEditor(owner),
       desiredWidth(150), isFading(false), accumulator(0.0),
       drawerButton(0), channelSelector(0),
-      isSelected(false), isEnabled(true), tNum(-1)
+      isSelected(false), isEnabled(true), tNum(-1), acquisitionIsActive(false)
 {
     constructorInitialize(owner, useDefaultParameterEditors);
 }
@@ -258,6 +258,8 @@ void GenericEditor::startAcquisition()
 
     }
 
+    acquisitionIsActive = true;
+
 }
 
 void GenericEditor::stopAcquisition()
@@ -273,6 +275,7 @@ void GenericEditor::stopAcquisition()
 
     }
 
+    acquisitionIsActive = false;
 
 }
 
diff --git a/Source/Processors/Editors/GenericEditor.h b/Source/Processors/Editors/GenericEditor.h
index ec14f362ea99cd25b80f7286b3afccc079220bf3..a2a092bf8e036ec89bda0c8abcc141e99087135a 100755
--- a/Source/Processors/Editors/GenericEditor.h
+++ b/Source/Processors/Editors/GenericEditor.h
@@ -222,6 +222,9 @@ public:
     /** Stores the font used to display the editor's name. */
     Font titleFont;
 
+    /** True if data acquisition has begun. */
+  	bool acquisitionIsActive;
+
 
 protected:
 
@@ -259,6 +262,7 @@ private:
     bool isSelected;
     bool isEnabled;
 
+
     int tNum;
 
     /**initializing function Used to share constructor functions*/
diff --git a/Source/Processors/Editors/RHD2000Editor.cpp b/Source/Processors/Editors/RHD2000Editor.cpp
index a10d65d6cbd83529d88d712acf59f96f68add886..6b9d4428c8516c4c994a43aa0dd8f7feb01dc5cc 100644
--- a/Source/Processors/Editors/RHD2000Editor.cpp
+++ b/Source/Processors/Editors/RHD2000Editor.cpp
@@ -99,8 +99,11 @@ HeadstageOptionsInterface::~HeadstageOptionsInterface()
 
 void HeadstageOptionsInterface::buttonClicked(Button* button)
 {
-	if (~(board->isThreadRunning()))
+
+	if (!(editor->acquisitionIsActive))
 	{
+
+		//std::cout << "Acquisition is not active" << std::endl;
 		if (isEnabled)
 		{
 			isEnabled = false;
@@ -109,11 +112,12 @@ void HeadstageOptionsInterface::buttonClicked(Button* button)
 		}
 
 		board->enableHeadstage(hsNumber, isEnabled);
-	}
 
-	repaint();
+		repaint();
 
-	editor->getEditorViewport()->makeEditorVisible(editor, false, true);
+		editor->getEditorViewport()->makeEditorVisible(editor, false, true);
+	}
+	
 }
 
 // void HeadstageOptionsInterface::mouseUp(const MouseEvent& event)
diff --git a/open-ephys.jucer b/open-ephys.jucer
index 0acde5af3c8dd5d6c24ef48d1c0d58337a3efbb6..1bcdb71a1f19b3fa393c1e9246df0fbfd84a879b 100644
--- a/open-ephys.jucer
+++ b/open-ephys.jucer
@@ -23,7 +23,7 @@
     <LINUX_MAKE targetFolder="Builds/Linux" vstFolder="~/SDKs/vstsdk2.4" juceFolder="JuceLibraryCode"
                 extraLinkerFlags="-lftdi -lftgl -pg -ldl -lXext" extraCompilerFlags="-export-dynamic -g -pg">
       <CONFIGURATIONS>
-        <CONFIGURATION name="Debug" isDebug="1" optimisation="1" targetName="open-ephys"
+        <CONFIGURATION name="Debug" isDebug="0" optimisation="3" targetName="open-ephys"
                        libraryPath="/usr/X11R6/lib/"/>
         <CONFIGURATION name="Release" isDebug="0" optimisation="3" targetName="open-ephys"
                        libraryPath="/usr/X11R6/lib/"/>