diff --git a/res/layout/activity_ara_plox.xml b/res/layout/activity_ara_plox.xml
index 0d0e8aa..4063dbb 100644
--- a/res/layout/activity_ara_plox.xml
+++ b/res/layout/activity_ara_plox.xml
@@ -3,12 +3,27 @@
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:orientation="vertical" >
-
-    <LinearLayout android:id="@+id/chart"
+    <TextView
+        android:id="@+id/textView"
+        android:layout_width="fill_parent"
+        android:layout_height="0dip"
+        android:gravity="center"
+        android:layout_weight="1"
+        android:background="#FFFFFF"
+        android:fontFamily="sans-serif"
+        android:textSize="32sp"
+        android:text="@string/hello_world" />
+    <LinearLayout android:id="@+id/irChart"
                   android:orientation="horizontal"
                   android:layout_width="fill_parent"
                   android:layout_height="0dip"
-                  android:layout_weight="2"/>
+                  android:layout_weight="3"/>
+    <LinearLayout android:id="@+id/redChart"
+                  android:orientation="horizontal"
+                  android:layout_width="fill_parent"
+                  android:layout_height="0dip"
+                  android:layout_weight="3"/>
+
 
 <!--
     <TextView
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d4f6f28..8c5ee37 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <string name="app_name">AraPloxIO</string>
-    <string name="hello_world">Hello world!</string>
+    <string name="hello_world">Pulse Monitor</string>
 </resources>
diff --git a/src/com/google/araploxio/AFE4400Thread.java b/src/com/google/araploxio/AFE4400Thread.java
index 84e949b..4193341 100644
--- a/src/com/google/araploxio/AFE4400Thread.java
+++ b/src/com/google/araploxio/AFE4400Thread.java
@@ -124,8 +124,7 @@
         while (!stopped) {
             Message msg;
             try {
-                msg = handler.obtainMessage(0, x++, ploxInputStream.readInt());
-                ploxInputStream.readInt();
+                msg = handler.obtainMessage(0, ploxInputStream.readInt(), ploxInputStream.readInt());
                 msg.sendToTarget();
             } catch (IOException e1) {
                 e1.printStackTrace();
@@ -170,10 +169,8 @@
             }
         }
 
-        int sample = 0;
         while (!isStopped()) {
             results = null;
-            boolean stop = true;
             byte[] data;
             int LED1VAL;
             int LED2VAL;
@@ -183,30 +180,45 @@
                                         0xff, 0xff, 0xff),    // 3 dummy bytes
                 I2cTransaction.newRead(4),
             };
+            I2cTransaction[] txns1 = {
+                I2cTransaction.newWrite(0x01,                 // Select SPI device 1
+                                        0x2f,                 // LED2-ALED2VAL
+                                        0xff, 0xff, 0xff),    // 3 dummy bytes
+                I2cTransaction.newRead(4),
+            };
+
 
             try {
-                if (stop) {
-                    for (I2cTransaction txn: txns0) {
-                        results = i2c.performTransactions(bus, address, txn);
-                    }
-                } else {
-                    results = i2c.performTransactions(bus, address, txns0);
+                for (I2cTransaction txn: txns0) {
+                    results = i2c.performTransactions(bus, address, txn);
                 }
             } catch (IOException e) {
                 setText("error while reading back: " + e);
                 return;
             }
 
-            if (stop)
-                data = results[0].data;
-            else
-                data = results[1].data;
+            data = results[0].data;
 
             LED1VAL = (((int)data[1]) << 16) |
                       (((int)data[2] & 0xFF) <<  8) |
                       (((int)data[3] & 0xFF));
 
-            Message msg = handler.obtainMessage(0, sample++, LED1VAL);
+            try {
+                for (I2cTransaction txn: txns1) {
+                    results = i2c.performTransactions(bus, address, txn);
+                }
+            } catch (IOException e) {
+                setText("error while reading back: " + e);
+                return;
+            }
+
+            data = results[0].data;
+
+            LED2VAL = (((int)data[1]) << 16) |
+                      (((int)data[2] & 0xFF) <<  8) |
+                      (((int)data[3] & 0xFF));
+
+            Message msg = handler.obtainMessage(0, LED1VAL, LED2VAL);
             msg.sendToTarget();
 
             try {
diff --git a/src/com/google/araploxio/AraPloxActivity.java b/src/com/google/araploxio/AraPloxActivity.java
index a0f8def..bc9a0af 100644
--- a/src/com/google/araploxio/AraPloxActivity.java
+++ b/src/com/google/araploxio/AraPloxActivity.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright (C) 2014 Google, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package com.google.araploxio;
 
 import org.achartengine.ChartFactory;
@@ -23,135 +39,154 @@
 
 public class AraPloxActivity extends Activity {
 	private static final String TAG = "AraPlox/Activity";
+    private static final int SCROLLBACK_SIZE = 200;
 
 	private static TextView bpmTextView;
 	private static Handler mHandler = null;
 	private static AFE4400Thread afe4400Thread = null;
-	private GraphicalView chart_view = null;
+    private static int sampleCount = 0;
 
-	protected void onCreate(Bundle savedInstanceState) {
-		super.onCreate(savedInstanceState);
-		Log.d(TAG, "onCreate()");
-		requestWindowFeature(Window.FEATURE_NO_TITLE);
-		setContentView(R.layout.activity_ara_plox);
-        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+    private AraPloxChart irPloxChart = new AraPloxChart(R.id.irChart);
+    private AraPloxChart redPloxChart = new AraPloxChart(R.id.redChart);
 
-		mHandler = new Handler() {
-			public void handleMessage(Message msg) {
-				handleAFE4400Message(msg);
-			}
-		};
-	}
+    private class AraPloxChart {
+        int id;
+        private XYMultipleSeriesRenderer renderer;
+        private XYMultipleSeriesDataset dataSet;
+        private XYSeriesRenderer xySeriesRenderer;
+        private XYSeries xySeries;
+        private GraphicalView chartView;
 
-	private void handleAFE4400Message(Message msg) {
-		//	Log.d(TAG, "Message received: arg1: " + msg.arg1 + " arg2: " + msg.arg2);
-		double x = msg.arg1;
-		double y = msg.arg2;
+        public AraPloxChart(int id) {
+            this.id = id;
+        }
 
-		xySeries.add(x, y);
-		// Scroll continuously after ~150 points
-		if (x > 200) {
-			xySeries.remove(0);
-		}
+        public void makeChart(int pointColor) {
+            dataSet = new XYMultipleSeriesDataset();
+            xySeries = new XYSeries("");
+            dataSet.addSeries(xySeries);
 
-        // Autoscale
-        double maxX = xySeries.getMaxX();
-        double minX = xySeries.getMinX();
-        double maxY = xySeries.getMaxY();
-        double minY = xySeries.getMinY();
+            int[] colors = new int[] {pointColor};
+            PointStyle[] styles = new PointStyle[] {PointStyle.CIRCLE};
 
-        maxY *= 1.02;
-        minY *= .98;
+            renderer = new XYMultipleSeriesRenderer();
 
-        renderer.setXAxisMax(maxX);
-        renderer.setXAxisMin(minX);
-        renderer.setYAxisMax(maxY);
-        renderer.setYAxisMin(minY);
+            int length = colors.length;
+            for (int i = 0; i < length; i++) {
+                xySeriesRenderer = new XYSeriesRenderer();
+                xySeriesRenderer.setFillPoints(true);
+                xySeriesRenderer.setLineWidth(10.0f);
+                xySeriesRenderer.setPointStrokeWidth(1);
+                xySeriesRenderer.setColor(colors[i]);
+                xySeriesRenderer.setPointStyle(styles[i]);
+                renderer.addSeriesRenderer(xySeriesRenderer);
+            }
 
-        chart_view.repaint();
+            renderer.setChartTitleTextSize(20);
+            renderer.setLabelsTextSize(15);
+            renderer.setLegendTextSize(15);
+            renderer.setPointSize(5f);
+            renderer.setMargins(new int[] { 50, 50, 50, 50 });
+            renderer.setXAxisMin(0);
+            renderer.setXAxisMax(10);
+            renderer.setYAxisMin(0);
+            renderer.setYAxisMax(100);
+            renderer.setAxesColor(Color.BLACK);
+            renderer.setLabelsColor(Color.BLACK);
+            renderer.setShowLegend(false);
+            renderer.setXLabels(10);
+            renderer.setYLabels(0);
+            renderer.setShowGrid(false);
+            renderer.setXLabelsAlign(Align.CENTER);
+            renderer.setApplyBackgroundColor(true);
+            renderer.setBackgroundColor(Color.WHITE);
+            renderer.setMarginsColor(Color.WHITE);
 
+            chartView = ChartFactory.getCubeLineChartView(getApplicationContext(), dataSet, renderer, 1.0f);
+
+            LinearLayout layout = (LinearLayout)findViewById(id);
+            layout.addView(chartView, new LayoutParams(LayoutParams.FILL_PARENT,
+                        LayoutParams.FILL_PARENT));
+            chartView.repaint();
+        }
+
+        public void removeChart() {
+            LinearLayout layout = (LinearLayout)findViewById(id);
+            layout.removeView(chartView);
+        }
+
+        public void handleNewSample(double x, double y) {
+            xySeries.add(x, y);
+
+            // Scroll continuously after SCROLLBACK_SIZE points
+            if (x > SCROLLBACK_SIZE) {
+                xySeries.remove(0);
+            }
+
+            // Autoscale
+            double maxX = xySeries.getMaxX();
+            double minX = xySeries.getMinX();
+            double maxY = xySeries.getMaxY();
+            double minY = xySeries.getMinY();
+
+            maxY *= 1.01;
+            minY *= .99;
+
+            renderer.setXAxisMax(maxX);
+            renderer.setXAxisMin(minX);
+            renderer.setYAxisMax(maxY);
+            renderer.setYAxisMin(minY);
+
+            chartView.repaint();
+
+            sampleCount++;
+        }
     }
 
-    private XYMultipleSeriesRenderer renderer;
-	private XYMultipleSeriesDataset dataSet;
-	private XYSeries xySeries;
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        Log.d(TAG, "onCreate()");
+        requestWindowFeature(Window.FEATURE_NO_TITLE);
+        setContentView(R.layout.activity_ara_plox);
+        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
 
-	private void makeChart() {
-		dataSet = new XYMultipleSeriesDataset();
-		xySeries = new XYSeries("");
-		dataSet.addSeries(xySeries);
+        mHandler = new Handler() {
+            public void handleMessage(Message msg) {
+                double irLedSample  = msg.arg1;
+                double redLedSample = msg.arg2;
 
-		int[] colors = new int[] {Color.RED};
-		PointStyle[] styles = new PointStyle[] {PointStyle.CIRCLE};
+                irPloxChart.handleNewSample(sampleCount, irLedSample);
+                redPloxChart.handleNewSample(sampleCount, redLedSample);
 
-		renderer = new XYMultipleSeriesRenderer();
+                sampleCount++;
+            }
+        };
+    }
 
-		int length = colors.length;
-		for (int i = 0; i < length; i++) {
-			XYSeriesRenderer r = new XYSeriesRenderer();
-			r.setFillPoints(true);
-			r.setLineWidth(10.0f);
-			r.setPointStrokeWidth(1);
-			r.setColor(colors[i]);
-			r.setPointStyle(styles[i]);
-			renderer.addSeriesRenderer(r);
-		}
+    protected void onResume() {
+        super.onResume();
+        Log.d(TAG, "onResume()");
+        if (afe4400Thread == null) {
+            afe4400Thread = new AFE4400Thread(getApplicationContext(), mHandler);
+            afe4400Thread.start();
+        }
+        irPloxChart.makeChart(Color.GREEN);
+        redPloxChart.makeChart(Color.RED);
+    }
 
-		renderer.setChartTitleTextSize(20);
-		renderer.setLabelsTextSize(15);
-		renderer.setLegendTextSize(15);
-		renderer.setPointSize(5f);
-		renderer.setMargins(new int[] { 100, 100, 100, 100 });
-		renderer.setXAxisMin(0);
-		renderer.setXAxisMax(10);
-		renderer.setYAxisMin(0);
-		renderer.setYAxisMax(100);
-		renderer.setAxesColor(Color.BLACK);
-		renderer.setLabelsColor(Color.BLACK);
-		renderer.setShowLegend(false);
-		renderer.setXLabels(10);
-		renderer.setYLabels(0);
-		renderer.setShowGrid(false);
-		renderer.setXLabelsAlign(Align.CENTER);
-		renderer.setApplyBackgroundColor(true);
-		renderer.setBackgroundColor(Color.WHITE);
-		renderer.setMarginsColor(Color.WHITE);
-		if (chart_view == null) {
-			LinearLayout layout = (LinearLayout) findViewById(R.id.chart);
-			chart_view = ChartFactory.getCubeLineChartView(this, dataSet, renderer, 1.0f);
-			layout.addView(chart_view, new LayoutParams(LayoutParams.FILL_PARENT,
-					LayoutParams.FILL_PARENT));
-			chart_view.repaint();
-		}
-	}
+    protected void onPause() {
+        super.onPause();
+        Log.d(TAG, "onPause()");
+        if (afe4400Thread != null) {
+            afe4400Thread.requestStop();
+            afe4400Thread = null;
+        }
+        irPloxChart.removeChart();
+        redPloxChart.removeChart();
+    }
 
-	protected void onResume() {
-		super.onResume();
-		Log.d(TAG, "onResume()");
-		if (afe4400Thread == null) {
-			afe4400Thread = new AFE4400Thread(getApplicationContext(), mHandler);
-			afe4400Thread.start();
-		}
-		makeChart();
-	}
-
-	protected void onPause() {
-		super.onPause();
-		Log.d(TAG, "onPause()");
-		if (afe4400Thread != null) {
-			afe4400Thread.requestStop();
-			afe4400Thread = null;
-		}
-
-	}
-
-	protected void onStop() {
-		super.onStop();
-		Log.d(TAG, "onStop()");
-		if (chart_view != null) {
-			LinearLayout layout = (LinearLayout) findViewById(R.id.chart);
-			layout.removeView(chart_view);
-			chart_view = null;
-		}
-	}
+    protected void onStop() {
+        super.onStop();
+        Log.d(TAG, "onStop()");
+    }
 }
