added main attribute
implemented two staged logging (64-128 datapoints in redis, then moved to couchdb)