Fixes #16 - Refactored examples in client.md (#19)

diff --git a/docs/client.md b/docs/client.md
index af02efe..836a2f8 100644
--- a/docs/client.md
+++ b/docs/client.md
@@ -18,58 +18,51 @@
 
 The following Java classes are examples of the Accumulo client API:
 
- * [Flush.java] - flushes a table
  * [RowOperations.java] - reads and writes rows
  * [ReadWriteExample.java] - creates a table, writes to it, and reads from it
 
-The Flush class will flush a table:
+[RowOperations.java] demonstrates how to read, write and delete rows using the BatchWriter and Scanner:
 
-    $ ./bin/runex client.Flush -c ./examples.conf -t trace
-
-The RowOperations class demonstrates how to read and write rows using the BatchWriter and Scanner:
-
-    $ ./bin/runex client.RowOperations -c ./examples.conf
-    2013-01-14 14:45:24,738 [client.RowOperations] INFO : This is everything
-    2013-01-14 14:45:24,744 [client.RowOperations] INFO : Key: row1 column:1 [] 1358192724640 false Value: This is the value for this key
-    2013-01-14 14:45:24,744 [client.RowOperations] INFO : Key: row1 column:2 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,744 [client.RowOperations] INFO : Key: row1 column:3 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,744 [client.RowOperations] INFO : Key: row1 column:4 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,746 [client.RowOperations] INFO : Key: row2 column:1 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,746 [client.RowOperations] INFO : Key: row2 column:2 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,746 [client.RowOperations] INFO : Key: row2 column:3 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,746 [client.RowOperations] INFO : Key: row2 column:4 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,747 [client.RowOperations] INFO : Key: row3 column:1 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,747 [client.RowOperations] INFO : Key: row3 column:2 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,747 [client.RowOperations] INFO : Key: row3 column:3 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,747 [client.RowOperations] INFO : Key: row3 column:4 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,756 [client.RowOperations] INFO : This is row1 and row3
-    2013-01-14 14:45:24,757 [client.RowOperations] INFO : Key: row1 column:1 [] 1358192724640 false Value: This is the value for this key
-    2013-01-14 14:45:24,757 [client.RowOperations] INFO : Key: row1 column:2 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,757 [client.RowOperations] INFO : Key: row1 column:3 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,757 [client.RowOperations] INFO : Key: row1 column:4 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,761 [client.RowOperations] INFO : Key: row3 column:1 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,761 [client.RowOperations] INFO : Key: row3 column:2 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,761 [client.RowOperations] INFO : Key: row3 column:3 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,761 [client.RowOperations] INFO : Key: row3 column:4 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,765 [client.RowOperations] INFO : This is just row3
-    2013-01-14 14:45:24,769 [client.RowOperations] INFO : Key: row3 column:1 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,770 [client.RowOperations] INFO : Key: row3 column:2 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,770 [client.RowOperations] INFO : Key: row3 column:3 [] 1358192724642 false Value: This is the value for this key
-    2013-01-14 14:45:24,770 [client.RowOperations] INFO : Key: row3 column:4 [] 1358192724642 false Value: This is the value for this key
+    $ ./bin/runex client.RowOperations
+    [examples.client.RowOperations] INFO : This is only row2
+    [examples.client.RowOperations] INFO : Key: row2 col:1 [] 1523301597006 false Value: v1
+    [examples.client.RowOperations] INFO : Key: row2 col:2 [] 1523301597006 false Value: v2
+    [examples.client.RowOperations] INFO : Key: row2 col:3 [] 1523301597006 false Value: v3
+    [examples.client.RowOperations] INFO : This is everything
+    [examples.client.RowOperations] INFO : Key: row1 col:1 [] 1523301597006 false Value: v1
+    [examples.client.RowOperations] INFO : Key: row1 col:2 [] 1523301597006 false Value: v2
+    [examples.client.RowOperations] INFO : Key: row1 col:3 [] 1523301597006 false Value: v3
+    [examples.client.RowOperations] INFO : Key: row2 col:1 [] 1523301597006 false Value: v1
+    [examples.client.RowOperations] INFO : Key: row2 col:2 [] 1523301597006 false Value: v2
+    [examples.client.RowOperations] INFO : Key: row2 col:3 [] 1523301597006 false Value: v3
+    [examples.client.RowOperations] INFO : Key: row3 col:1 [] 1523301597006 false Value: v1
+    [examples.client.RowOperations] INFO : Key: row3 col:2 [] 1523301597006 false Value: v2
+    [examples.client.RowOperations] INFO : Key: row3 col:3 [] 1523301597006 false Value: v3
+    [examples.client.RowOperations] INFO : This is row1 and row3
+    [examples.client.RowOperations] INFO : Key: row1 col:1 [] 1523301597006 false Value: v1
+    [examples.client.RowOperations] INFO : Key: row1 col:2 [] 1523301597006 false Value: v2
+    [examples.client.RowOperations] INFO : Key: row1 col:3 [] 1523301597006 false Value: v3
+    [examples.client.RowOperations] INFO : Key: row3 col:1 [] 1523301597006 false Value: v1
+    [examples.client.RowOperations] INFO : Key: row3 col:2 [] 1523301597006 false Value: v2
+    [examples.client.RowOperations] INFO : Key: row3 col:3 [] 1523301597006 false Value: v3
+    [examples.client.RowOperations] INFO : This is just row3
+    [examples.client.RowOperations] INFO : Key: row3 col:1 [] 1523301597006 false Value: v1
+    [examples.client.RowOperations] INFO : Key: row3 col:2 [] 1523301597006 false Value: v2
+    [examples.client.RowOperations] INFO : Key: row3 col:3 [] 1523301597006 false Value: v3
 
 To create a table, write to it and read from it:
 
-    $ ./bin/runex client.ReadWriteExample -c ./examples.conf --createtable --create --read
-    hello%00; datatypes:xml [LEVEL1|GROUP1] 1358192329450 false -> world
-    hello%01; datatypes:xml [LEVEL1|GROUP1] 1358192329450 false -> world
-    hello%02; datatypes:xml [LEVEL1|GROUP1] 1358192329450 false -> world
-    hello%03; datatypes:xml [LEVEL1|GROUP1] 1358192329450 false -> world
-    hello%04; datatypes:xml [LEVEL1|GROUP1] 1358192329450 false -> world
-    hello%05; datatypes:xml [LEVEL1|GROUP1] 1358192329450 false -> world
-    hello%06; datatypes:xml [LEVEL1|GROUP1] 1358192329450 false -> world
-    hello%07; datatypes:xml [LEVEL1|GROUP1] 1358192329450 false -> world
-    hello%08; datatypes:xml [LEVEL1|GROUP1] 1358192329450 false -> world
-    hello%09; datatypes:xml [LEVEL1|GROUP1] 1358192329450 false -> world
+    $ ./bin/runex client.ReadWriteExample
+    [examples.client.ReadWriteExample] INFO : hello0 cf:cq [] 1523306675130 false -> world0
+    [examples.client.ReadWriteExample] INFO : hello1 cf:cq [] 1523306675130 false -> world1
+    [examples.client.ReadWriteExample] INFO : hello2 cf:cq [] 1523306675130 false -> world2
+    [examples.client.ReadWriteExample] INFO : hello3 cf:cq [] 1523306675130 false -> world3
+    [examples.client.ReadWriteExample] INFO : hello4 cf:cq [] 1523306675130 false -> world4
+    [examples.client.ReadWriteExample] INFO : hello5 cf:cq [] 1523306675130 false -> world5
+    [examples.client.ReadWriteExample] INFO : hello6 cf:cq [] 1523306675130 false -> world6
+    [examples.client.ReadWriteExample] INFO : hello7 cf:cq [] 1523306675130 false -> world7
+    [examples.client.ReadWriteExample] INFO : hello8 cf:cq [] 1523306675130 false -> world8
+    [examples.client.ReadWriteExample] INFO : hello9 cf:cq [] 1523306675130 false -> world9
 
 [Flush.java]: ../src/main/java/org/apache/accumulo/examples/client/Flush.java
 [RowOperations.java]: ../src/main/java/org/apache/accumulo/examples/client/RowOperations.java
diff --git a/src/main/java/org/apache/accumulo/examples/client/ReadWriteExample.java b/src/main/java/org/apache/accumulo/examples/client/ReadWriteExample.java
index d4cfe19..0fcb4ce 100644
--- a/src/main/java/org/apache/accumulo/examples/client/ReadWriteExample.java
+++ b/src/main/java/org/apache/accumulo/examples/client/ReadWriteExample.java
@@ -17,135 +17,57 @@
 package org.apache.accumulo.examples.client;
 
 import java.util.Map.Entry;
-import java.util.SortedSet;
-import java.util.TreeSet;
 
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.Durability;
+import org.apache.accumulo.core.client.NamespaceExistsException;
 import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.impl.DurabilityImpl;
+import org.apache.accumulo.core.client.TableExistsException;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.ColumnVisibility;
-import org.apache.accumulo.core.util.ByteArraySet;
-import org.apache.accumulo.examples.cli.ClientOnDefaultTable;
-import org.apache.accumulo.examples.cli.ScannerOpts;
-import org.apache.hadoop.io.Text;
-
-import com.beust.jcommander.IStringConverter;
-import com.beust.jcommander.Parameter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ReadWriteExample {
-  // defaults
-  private static final String DEFAULT_AUTHS = "LEVEL1,GROUP1";
-  private static final String DEFAULT_TABLE_NAME = "test";
 
-  private Connector conn;
+  private static final Logger log = LoggerFactory.getLogger(ReadWriteExample.class);
+  private static final String namespace = "examples";
+  private static final String table = namespace + ".readwrite";
 
-  static class DurabilityConverter implements IStringConverter<Durability> {
-    @Override
-    public Durability convert(String value) {
-      return DurabilityImpl.fromString(value);
+  public static void main(String[] args) throws Exception {
+
+    Connector connector = Connector.builder().usingProperties("conf/accumulo-client.properties").build();
+
+    try {
+      connector.namespaceOperations().create(namespace);
+    } catch (NamespaceExistsException e) {
+      // ignore
     }
-  }
-
-  static class Opts extends ClientOnDefaultTable {
-    @Parameter(names = {"--createtable"}, description = "create table before doing anything")
-    boolean createtable = false;
-    @Parameter(names = {"--deletetable"}, description = "delete table when finished")
-    boolean deletetable = false;
-    @Parameter(names = {"--create"}, description = "create entries before any deletes")
-    boolean createEntries = false;
-    @Parameter(names = {"--read"}, description = "read entries after any creates/deletes")
-    boolean readEntries = false;
-    @Parameter(names = {"--delete"}, description = "delete entries after any creates")
-    boolean deleteEntries = false;
-    @Parameter(names = {"--durability"}, description = "durability used for writes (none, log, flush or sync)", converter = DurabilityConverter.class)
-    Durability durability = Durability.DEFAULT;
-
-    public Opts() {
-      super(DEFAULT_TABLE_NAME);
-      auths = new Authorizations(DEFAULT_AUTHS.split(","));
-    }
-  }
-
-  // hidden constructor
-  private ReadWriteExample() {}
-
-  private void execute(Opts opts, ScannerOpts scanOpts) throws Exception {
-    conn = opts.getConnector();
-
-    // add the authorizations to the user
-    Authorizations userAuthorizations = conn.securityOperations().getUserAuthorizations(opts.getPrincipal());
-    ByteArraySet auths = new ByteArraySet(userAuthorizations.getAuthorizations());
-    auths.addAll(opts.auths.getAuthorizations());
-    if (!auths.isEmpty())
-      conn.securityOperations().changeUserAuthorizations(opts.getPrincipal(), new Authorizations(auths));
-
-    // create table
-    if (opts.createtable) {
-      SortedSet<Text> partitionKeys = new TreeSet<>();
-      for (int i = Byte.MIN_VALUE; i < Byte.MAX_VALUE; i++)
-        partitionKeys.add(new Text(new byte[] {(byte) i}));
-      conn.tableOperations().create(opts.getTableName());
-      conn.tableOperations().addSplits(opts.getTableName(), partitionKeys);
+    try {
+      connector.tableOperations().create(table);
+    } catch (TableExistsException e) {
+      // ignore
     }
 
-    // send mutations
-    createEntries(opts);
+    // write data
+    try (BatchWriter writer = connector.createBatchWriter(table)) {
+      for (int i = 0; i < 10; i++) {
+        Mutation m = new Mutation("hello" + i);
+        m.put("cf", "cq", new Value("world" + i));
+        writer.addMutation(m);
+      }
+    }
 
-    // read entries
-    if (opts.readEntries) {
-      // Note that the user needs to have the authorizations for the specified scan authorizations
-      // by an administrator first
-      Scanner scanner = conn.createScanner(opts.getTableName(), opts.auths);
-      scanner.setBatchSize(scanOpts.scanBatchSize);
-      for (Entry<Key,Value> entry : scanner)
-        System.out.println(entry.getKey().toString() + " -> " + entry.getValue().toString());
+    // read data
+    try (Scanner scanner = connector.createScanner(table, Authorizations.EMPTY)) {
+      for (Entry<Key, Value> entry : scanner) {
+        log.info(entry.getKey().toString() + " -> " + entry.getValue().toString());
+      }
     }
 
     // delete table
-    if (opts.deletetable)
-      conn.tableOperations().delete(opts.getTableName());
-  }
-
-  private void createEntries(Opts opts) throws Exception {
-    if (opts.createEntries || opts.deleteEntries) {
-      BatchWriterConfig cfg = new BatchWriterConfig();
-      cfg.setDurability(opts.durability);
-      BatchWriter writer = conn.createBatchWriter(opts.getTableName(), cfg);
-      ColumnVisibility cv = new ColumnVisibility(opts.auths.toString().replace(',', '|'));
-
-      Text cf = new Text("datatypes");
-      Text cq = new Text("xml");
-      byte[] row = {'h', 'e', 'l', 'l', 'o', '\0'};
-      byte[] value = {'w', 'o', 'r', 'l', 'd', '\0'};
-
-      for (int i = 0; i < 10; i++) {
-        row[row.length - 1] = (byte) i;
-        Mutation m = new Mutation(new Text(row));
-        if (opts.deleteEntries) {
-          m.putDelete(cf, cq, cv);
-        }
-        if (opts.createEntries) {
-          value[value.length - 1] = (byte) i;
-          m.put(cf, cq, cv, new Value(value));
-        }
-        writer.addMutation(m);
-      }
-      writer.close();
-    }
-  }
-
-  public static void main(String[] args) throws Exception {
-    ReadWriteExample rwe = new ReadWriteExample();
-    Opts opts = new Opts();
-    ScannerOpts scanOpts = new ScannerOpts();
-    opts.parseArgs(ReadWriteExample.class.getName(), args, scanOpts);
-    rwe.execute(opts, scanOpts);
+    connector.tableOperations().delete(table);
   }
 }
diff --git a/src/main/java/org/apache/accumulo/examples/client/RowOperations.java b/src/main/java/org/apache/accumulo/examples/client/RowOperations.java
index b535d4c..7787c13 100644
--- a/src/main/java/org/apache/accumulo/examples/client/RowOperations.java
+++ b/src/main/java/org/apache/accumulo/examples/client/RowOperations.java
@@ -16,8 +16,6 @@
  */
 package org.apache.accumulo.examples.client;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
-
 import java.util.Map.Entry;
 
 import org.apache.accumulo.core.client.AccumuloException;
@@ -25,6 +23,7 @@
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.MutationsRejectedException;
+import org.apache.accumulo.core.client.NamespaceExistsException;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.TableExistsException;
 import org.apache.accumulo.core.client.TableNotFoundException;
@@ -33,10 +32,6 @@
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.examples.cli.BatchWriterOpts;
-import org.apache.accumulo.examples.cli.ClientOpts;
-import org.apache.accumulo.examples.cli.ScannerOpts;
-import org.apache.hadoop.io.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,170 +41,96 @@
 public class RowOperations {
 
   private static final Logger log = LoggerFactory.getLogger(RowOperations.class);
+  private static final String namespace = "examples";
+  private static final String table = namespace + ".rowops";
 
-  private static Connector connector;
-  private static String tableName = "example";
-  private static BatchWriter bw;
+  private static void printAll(Connector connector) throws TableNotFoundException {
+    try (Scanner scanner = connector.createScanner("rowops", Authorizations.EMPTY)) {
+      for (Entry<Key,Value> entry : scanner) {
+        log.info("Key: " + entry.getKey().toString() + " Value: " + entry.getValue().toString());
+      }
+    }
+  }
 
-  public static void main(String[] args) throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException,
-      MutationsRejectedException {
+  private static void printRow(String row, Connector connector) throws TableNotFoundException {
+    try (Scanner scanner = connector.createScanner("rowops", Authorizations.EMPTY)) {
+      scanner.setRange(Range.exact(row));
+      for (Entry<Key,Value> entry : scanner) {
+        log.info("Key: " + entry.getKey().toString() + " Value: " + entry.getValue().toString());
+      }
+    }
+  }
 
-    ClientOpts opts = new ClientOpts();
-    ScannerOpts scanOpts = new ScannerOpts();
-    BatchWriterOpts bwOpts = new BatchWriterOpts();
-    opts.parseArgs(RowOperations.class.getName(), args, scanOpts, bwOpts);
+  private static void deleteRow(String row, Connector connector, BatchWriter bw) throws MutationsRejectedException, TableNotFoundException {
+    Mutation mut = new Mutation(row);
+    try (Scanner scanner = connector.createScanner("rowops", Authorizations.EMPTY)) {
+      scanner.setRange(Range.exact(row));
+      for (Entry<Key,Value> entry : scanner) {
+        mut.putDelete(entry.getKey().getColumnFamily(), entry.getKey().getColumnQualifier());
+      }
+    }
+    bw.addMutation(mut);
+    bw.flush();
+  }
 
-    // First the setup work
-    connector = opts.getConnector();
-
-    // lets create an example table
-    connector.tableOperations().create(tableName);
+  public static void main(String[] args) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
+    Connector connector = Connector.builder().usingProperties("conf/accumulo-client.properties").build();
+    try {
+      connector.namespaceOperations().create(namespace);
+    } catch (NamespaceExistsException e) {
+      // ignore
+    }
+    try {
+      connector.tableOperations().create(table);
+    } catch (TableExistsException e) {
+      // ignore
+    }
 
     // lets create 3 rows of information
-    Text row1 = new Text("row1");
-    Text row2 = new Text("row2");
-    Text row3 = new Text("row3");
+    Mutation mut1 = new Mutation("row1");
+    Mutation mut2 = new Mutation("row2");
+    Mutation mut3 = new Mutation("row3");
 
-    // Which means 3 different mutations
-    Mutation mut1 = new Mutation(row1);
-    Mutation mut2 = new Mutation(row2);
-    Mutation mut3 = new Mutation(row3);
+    mut1.put("col", "1", "v1");
+    mut1.put("col", "2", "v2");
+    mut1.put("col", "3", "v3");
 
-    // And we'll put 4 columns in each row
-    Text col1 = new Text("1");
-    Text col2 = new Text("2");
-    Text col3 = new Text("3");
-    Text col4 = new Text("4");
+    mut2.put("col", "1", "v1");
+    mut2.put("col", "2", "v2");
+    mut2.put("col", "3", "v3");
 
-    // Now we'll add them to the mutations
-    mut1.put(new Text("column"), col1, System.currentTimeMillis(), new Value("This is the value for this key".getBytes(UTF_8)));
-    mut1.put(new Text("column"), col2, System.currentTimeMillis(), new Value("This is the value for this key".getBytes(UTF_8)));
-    mut1.put(new Text("column"), col3, System.currentTimeMillis(), new Value("This is the value for this key".getBytes(UTF_8)));
-    mut1.put(new Text("column"), col4, System.currentTimeMillis(), new Value("This is the value for this key".getBytes(UTF_8)));
-
-    mut2.put(new Text("column"), col1, System.currentTimeMillis(), new Value("This is the value for this key".getBytes(UTF_8)));
-    mut2.put(new Text("column"), col2, System.currentTimeMillis(), new Value("This is the value for this key".getBytes(UTF_8)));
-    mut2.put(new Text("column"), col3, System.currentTimeMillis(), new Value("This is the value for this key".getBytes(UTF_8)));
-    mut2.put(new Text("column"), col4, System.currentTimeMillis(), new Value("This is the value for this key".getBytes(UTF_8)));
-
-    mut3.put(new Text("column"), col1, System.currentTimeMillis(), new Value("This is the value for this key".getBytes(UTF_8)));
-    mut3.put(new Text("column"), col2, System.currentTimeMillis(), new Value("This is the value for this key".getBytes(UTF_8)));
-    mut3.put(new Text("column"), col3, System.currentTimeMillis(), new Value("This is the value for this key".getBytes(UTF_8)));
-    mut3.put(new Text("column"), col4, System.currentTimeMillis(), new Value("This is the value for this key".getBytes(UTF_8)));
+    mut3.put("col", "1", "v1");
+    mut3.put("col", "2", "v2");
+    mut3.put("col", "3", "v3");
 
     // Now we'll make a Batch Writer
-    bw = connector.createBatchWriter(tableName, bwOpts.getBatchWriterConfig());
+    try (BatchWriter bw = connector.createBatchWriter(table)) {
 
-    // And add the mutations
-    bw.addMutation(mut1);
-    bw.addMutation(mut2);
-    bw.addMutation(mut3);
+      // And add the mutations
+      bw.addMutation(mut1);
+      bw.addMutation(mut2);
+      bw.addMutation(mut3);
 
-    // Force a send
-    bw.flush();
+      // Force a send
+      bw.flush();
 
-    // Now lets look at the rows
-    Scanner rowThree = getRow(scanOpts, new Text("row3"));
-    Scanner rowTwo = getRow(scanOpts, new Text("row2"));
-    Scanner rowOne = getRow(scanOpts, new Text("row1"));
+      log.info("This is only row2");
+      printRow("row2", connector);
 
-    // And print them
-    log.info("This is everything");
-    printRow(rowOne);
-    printRow(rowTwo);
-    printRow(rowThree);
-    System.out.flush();
+      log.info("This is everything");
+      printAll(connector);
 
-    // Now lets delete rowTwo with the iterator
-    rowTwo = getRow(scanOpts, new Text("row2"));
-    deleteRow(rowTwo);
+      deleteRow("row2", connector, bw);
 
-    // Now lets look at the rows again
-    rowThree = getRow(scanOpts, new Text("row3"));
-    rowTwo = getRow(scanOpts, new Text("row2"));
-    rowOne = getRow(scanOpts, new Text("row1"));
+      log.info("This is row1 and row3");
+      printAll(connector);
 
-    // And print them
-    log.info("This is row1 and row3");
-    printRow(rowOne);
-    printRow(rowTwo);
-    printRow(rowThree);
-    System.out.flush();
+      deleteRow("row1", connector, bw);
+   }
 
-    // Should only see the two rows
-    // Now lets delete rowOne without passing in the iterator
-
-    deleteRow(scanOpts, row1);
-
-    // Now lets look at the rows one last time
-    rowThree = getRow(scanOpts, new Text("row3"));
-    rowTwo = getRow(scanOpts, new Text("row2"));
-    rowOne = getRow(scanOpts, new Text("row1"));
-
-    // And print them
     log.info("This is just row3");
-    printRow(rowOne);
-    printRow(rowTwo);
-    printRow(rowThree);
-    System.out.flush();
+    printAll(connector);
 
-    // Should only see rowThree
-
-    // Always close your batchwriter
-
-    bw.close();
-
-    // and lets clean up our mess
-    connector.tableOperations().delete(tableName);
-
-    // fin~
-
+    connector.tableOperations().delete(table);
   }
-
-  /**
-   * Deletes a row given a text object
-   */
-  private static void deleteRow(ScannerOpts scanOpts, Text row) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
-    deleteRow(getRow(scanOpts, row));
-  }
-
-  /**
-   * Deletes a row, given a Scanner of JUST that row
-   */
-  private static void deleteRow(Scanner scanner) throws MutationsRejectedException {
-    Mutation deleter = null;
-    // iterate through the keys
-    for (Entry<Key,Value> entry : scanner) {
-      // create a mutation for the row
-      if (deleter == null)
-        deleter = new Mutation(entry.getKey().getRow());
-      // the remove function adds the key with the delete flag set to true
-      deleter.putDelete(entry.getKey().getColumnFamily(), entry.getKey().getColumnQualifier());
-    }
-    bw.addMutation(deleter);
-    bw.flush();
-  }
-
-  /**
-   * Just a generic print function given an iterator. Not necessarily just for printing a single row
-   */
-  private static void printRow(Scanner scanner) {
-    // iterates through and prints
-    for (Entry<Key,Value> entry : scanner)
-      log.info("Key: " + entry.getKey().toString() + " Value: " + entry.getValue().toString());
-  }
-
-  /**
-   * Gets a scanner over one row
-   */
-  private static Scanner getRow(ScannerOpts scanOpts, Text row) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
-    // Create a scanner
-    Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY);
-    scanner.setBatchSize(scanOpts.scanBatchSize);
-    // Say start key is the one with key of row
-    // and end key is the one that immediately follows the row
-    scanner.setRange(new Range(row));
-    return scanner;
-  }
-
 }