       ; close it.
       )))
 
-
+(defn final   [_ _] {:type :invoke, :f :final, :value nil})
 (defn r   [_ _] {:type :invoke, :f :read, :value nil})
-(defn w   [_ _] {:type :invoke, :f :write, :value (rand-int 100)})
-(defn cas [_ _] {:type :invoke, :f :cas, :value [(rand-int 100) (rand-int 100)]})
-(defn hget [_ _] {:type :invoke, :f :hget, :value [(rand-int 100) nil]})
-(defn hset [_ _] {:type :invoke, :f :hset, :value [(rand-int 100) (rand-int 100)]})
-
-(defrecord CellRegister [value hashtable list set zset]
+(defn w   [_ _] {:type :invoke, :f :write, :value (rand-int 10)})			;generate random value for write operation
+(defn cas [_ _] {:type :invoke, :f :cas, :value [(rand-int 10) (rand-int 10)]})
+(defn hget [_ _] {:type :invoke, :f :hget, :value [(rand-int 10) nil]})
+(defn hset [_ _] {:type :invoke, :f :hset, :value [(rand-int 10) (rand-int 10000)]})
+
+(def tables (transient {}))
+
+(defn tables-get  [k]   (get tables k))
+(defn tables-set  [k v] (assoc! tables k v))
+(defn tables-count [] (count tables))
+(defn tables-print []  (prn (persistent! tables)))
+
+(defrecord CellRegister [value hashtable]
   Model
   (step [r op]
     do  
         (condp = (:f op)
-          :write (CellRegister. (:value op) hashtable list set zset)
+          :write (CellRegister. (:value op) hashtable)
           :cas   (let [[cur new] (:value op)]
                   (if (= cur value)
-                    (CellRegister. new hashtable list set zset)
+                    (CellRegister. new hashtable)
                     (inconsistent (str "can't CAS " value " from " cur
                                         " to " new))))
           :read  (if (or (nil? (:value op))

  [s]
  (when s (Long/parseLong s)))

(def server1-conn {:pool {:max-total 8} :spec {:host "10.214.160.200" :port 6379 :timeout-ms 6000}}) 
(defmacro wcar* [& body] `(car/wcar server1-conn ~@body))

(defn client

                  r
                  (inconsistent (str "can't read " (:value op)
                                      " from register " value)))
          :hset  (let [ [new-member new-value] (:value op)]
                    (do (tables-set new-member new-value)
                        (CellRegister. value  (tables-count))))
          :hget  (let [ [new-member new-value] (:value op)]
                    (if  (= (tables-get new-member) new-value)
                          r
                          (do ;(throw (ex-info (str "hget wrong, new-member " new-member
                              ;         " tables-get from register: " (tables-get new-member)
                              ;        " client get new-value " new-value) {}))
                              (inconsistent (str "hget wrong, new-member " new-member
                                        " tables-get from register: " (tables-get new-member)
                                        " client get new-value " new-value)))
                    ))
          :final (do (def tables (transient {})) r)
                          ))
  Object
  (toString [this] (pr-str "value:" value " hashtable:" hashtable)))

(defn elasticell-register
  "A cell register"
  ([] (elasticell-register nil))
  ([value] (do (info "call elasticell-register") (CellRegister. value 0)) ))

(defn nemesis-gen
  "A generator which emits a start after a t1 second delay, and then a stop
  after a t2 second delay."
  []
  (gen/seq [
	(gen/sleep 1)
        {:type :info :f :start}
	(gen/sleep 2)
        {:type :info :f :paused}
	(gen/sleep 3)
        {:type :info :f :stop}
	(gen/sleep 4)
        {:type :info :f :resumed}
       ])
)

(defn elasticell-test
  "Given an options map from the command-line runner (e.g. :nodes, :ssh,
