Fixed CouchState and added testing classes.