Switched to slices, moved writebatch into its own file.  Lots of cleanup