Changes to bulk couchdb storage implementation

Fixed bug where there could be several copies of one string, made some memory usage optimizations.