diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000000000000000000000000000000000000..833c43e908ff82f69998177fa63fda270758568c
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,30 @@
+{
+	"version": "0.2.0",
+	"configurations": [
+		{
+			"name": "Launch",
+			"type": "node",
+			"request": "launch",
+			"program": "node_modules/gulp/bin/gulp.js",
+			"stopOnEntry": false,
+			"args": ["test"],
+			"cwd": ".",
+			"runtimeExecutable": null,
+			"runtimeArgs": [
+				"--nolazy"
+			],
+			"env": {
+				"NODE_ENV": "development"
+			},
+			"externalConsole": false,
+			"sourceMaps": false,
+			"outDir": null
+		},
+		{
+			"name": "Attach",
+			"type": "node",
+			"request": "attach",
+			"port": 5858
+		}
+	]
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000000000000000000000000000000000000..20af2f68a65875723ab04e6607c5f965cfa01de1
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+// Place your settings in this file to overwrite default and user settings.
+{
+}
\ No newline at end of file
diff --git a/jsconfig.json b/jsconfig.json
new file mode 100644
index 0000000000000000000000000000000000000000..56705eaddb4ccabb518644b6a43c68cd22b3097a
--- /dev/null
+++ b/jsconfig.json
@@ -0,0 +1,6 @@
+{
+	"compilerOptions": {
+		"target": "ES6",
+		"module": "commonjs"
+	}
+}
\ No newline at end of file
diff --git a/src/Connector.js b/src/Connector.js
index 3fa4ad2a2e7c329ba1a78deac09676c8d3044476..9ff9db4f423817098db6e707c6d4094ccb142a71 100644
--- a/src/Connector.js
+++ b/src/Connector.js
@@ -189,26 +189,26 @@ module.exports = function (Y) {
         var broadcastHB = !this.broadcastedHB
         this.broadcastedHB = true
         var db = this.y.db
-        this.syncStep2 = new Promise(function (resolve) {
+        var defer = Promise.defer()
+        this.syncStep2 = defer.promise 
+        db.requestTransaction(function * () {
+          yield* this.applyDeleteSet(m.deleteSet)
+          this.store.apply(m.os)
           db.requestTransaction(function * () {
-            yield* this.applyDeleteSet(m.deleteSet)
-            this.store.apply(m.os)
-            db.requestTransaction(function * () {
-              var ops = yield* this.getOperations(m.stateSet)
-              if (ops.length > 0) {
-                m = {
-                  type: 'update',
-                  ops: ops
-                }
-                if (!broadcastHB) { // TODO: consider to broadcast here..
-                  conn.send(sender, m)
-                } else {
-                  // broadcast only once!
-                  conn.broadcast(m)
-                }
+            var ops = yield* this.getOperations(m.stateSet)
+            if (ops.length > 0) {
+              m = {
+                type: 'update',
+                ops: ops
               }
-              resolve()
-            })
+              if (!broadcastHB) { // TODO: consider to broadcast here..
+                conn.send(sender, m)
+              } else {
+                // broadcast only once!
+                conn.broadcast(m)
+              }
+            }
+            defer.resolve()
           })
         })
       } else if (m.type === 'sync done') {
diff --git a/src/Connectors/Test.js b/src/Connectors/Test.js
index 9e798a5417acca66f101b3dc94a600f47ec8ba00..97d7329aea3c1c0c5d71386165130a09962194bd 100644
--- a/src/Connectors/Test.js
+++ b/src/Connectors/Test.js
@@ -24,11 +24,16 @@ module.exports = function (Y) {
       }
     },
     whenTransactionsFinished: function () {
-      var ps = []
-      for (var name in this.users) {
-        ps.push(this.users[name].y.db.whenTransactionsFinished())
-      }
-      return Promise.all(ps)
+      var self = this
+      return new Promise (function (resolve) {
+        wait().then(function () {
+          var ps = []
+          for (var name in self.users) {
+            ps.push(self.users[name].y.db.whenTransactionsFinished())
+          }
+          Promise.all(ps).then(resolve)
+        })
+      })
     },
     flushOne: function flushOne () {
       var bufs = []
@@ -46,6 +51,32 @@ module.exports = function (Y) {
       } else {
         return false
       }
+    },
+    flushAll: function () {
+      return new Promise(function (resolve) {
+        // flushes may result in more created operations,
+        // flush until there is nothing more to flush
+        function nextFlush () {
+          var c = globalRoom.flushOne()
+          if (c) {
+            while (c = globalRoom.flushOne()) {
+            }
+            globalRoom.whenTransactionsFinished().then(nextFlush)              
+          } else {
+            setTimeout(function () {
+              var c = globalRoom.flushOne()
+              if (c) {
+                c.then(function () {
+                  globalRoom.whenTransactionsFinished().then(nextFlush)                  
+                })
+              } else {
+                resolve()
+              }
+            }, 10)
+          }
+        }
+        globalRoom.whenTransactionsFinished().then(nextFlush)
+      })
     }
   }
   Y.utils.globalRoom = globalRoom
@@ -88,7 +119,7 @@ module.exports = function (Y) {
         globalRoom.addUser(this)
         super.reconnect()
       }
-      return this.flushAll()
+      return Y.utils.globalRoom.flushAll()
     }
     disconnect () {
       if (!this.isDisconnected()) {
@@ -107,24 +138,6 @@ module.exports = function (Y) {
         yield self.whenTransactionsFinished()
       })
     }
-    flushAll () {
-      return new Promise(function (resolve) {
-        // flushes may result in more created operations,
-        // flush until there is nothing more to flush
-        function nextFlush () {
-          var c = globalRoom.flushOne()
-          if (c) {
-            while (globalRoom.flushOne()) {
-              // nop
-            }
-            globalRoom.whenTransactionsFinished().then(nextFlush)
-          } else {
-            resolve()
-          }
-        }
-        globalRoom.whenTransactionsFinished().then(nextFlush)
-      })
-    }
   }
 
   Y.Test = Test
diff --git a/src/Database.js b/src/Database.js
index e69778883f06f1449ff8dc1b80ed297423cdaccd..d733e18a23cbeca5acc2a70da883f243b927aa0a 100644
--- a/src/Database.js
+++ b/src/Database.js
@@ -343,14 +343,15 @@ module.exports = function (Y) {
     requestTransaction (makeGen, callImmediately) {
       if (callImmediately) {
         this.transact(makeGen)
-      } else if (!this.transactionInProgress) {
-        this.transactionInProgress = true
-        var self = this
-        setTimeout(function () {
-          self.transact(makeGen)
-        }, 0)
       } else {
         this.waitingTransactions.push(makeGen)
+        if (!this.transactionInProgress) {
+          this.transactionInProgress = true
+          var self = this
+          setTimeout(function () {
+            self.transact(self.getNextRequest())
+          }, 0)
+        }
       }
     }
   }
diff --git a/src/Database.spec.js b/src/Database.spec.js
index d8ee4922a4618ff4c1032af712865131a905f4df..96b07a96afeabda24abdd4d6ac585ac4e72b3f7f 100644
--- a/src/Database.spec.js
+++ b/src/Database.spec.js
@@ -1,4 +1,4 @@
-/* global async, databases */
+/* global async, databases, describe, beforeEach, afterEach */
 /* eslint-env browser,jasmine,console */
 'use strict'
 
diff --git a/src/SpecHelper.js b/src/SpecHelper.js
index 41f2363dbcce19a7a8611296878d76895aeb7521..5a80de994f947328884bf239296b9602ef5d328d 100644
--- a/src/SpecHelper.js
+++ b/src/SpecHelper.js
@@ -24,7 +24,7 @@ g.g = g
 
 g.YConcurrency_TestingMode = true
 
-jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000
+jasmine.DEFAULT_TIMEOUT_INTERVAL = 8000
 
 g.describeManyTimes = function describeManyTimes (times, name, f) {
   for (var i = 0; i < times; i++) {
@@ -36,8 +36,6 @@ g.describeManyTimes = function describeManyTimes (times, name, f) {
   Wait for a specified amount of time (in ms). defaults to 5ms
 */
 function wait (t) {
-  throw new Error("waiting..")
-  console.log("waiting..", t)
   if (t == null) {
     t = 5
   }
@@ -106,24 +104,24 @@ function * applyTransactions (relAmount, numberOfTransactions, objects, users, t
 
 g.applyRandomTransactionsAllRejoinNoGC = async(function * applyRandomTransactions (users, objects, transactions, numberOfTransactions) {
   yield* applyTransactions(1, numberOfTransactions, objects, users, transactions)
-  yield users[0].connector.flushAll()
+  yield Y.utils.globalRoom.flushAll()
   for (var u in users) {
     yield users[u].reconnect()
   }
-  yield users[0].connector.flushAll()
+  yield Y.utils.globalRoom.flushAll()
   yield g.garbageCollectAllUsers(users)
 })
 
 g.applyRandomTransactionsWithGC = async(function * applyRandomTransactions (users, objects, transactions, numberOfTransactions) {
   yield* applyTransactions(1, numberOfTransactions, objects, users.slice(1), transactions)
-  yield users[0].connector.flushAll()
+  yield Y.utils.globalRoom.flushAll()
   yield g.garbageCollectAllUsers(users)
   for (var u in users) {
     // TODO: here, we enforce that two users never sync at the same time with u[0]
     //       enforce that in the connector itself!
     yield users[u].reconnect()
   }
-  yield users[0].connector.flushAll()
+  yield Y.utils.globalRoom.flushAll()
   yield g.garbageCollectAllUsers(users)
 })
 
@@ -158,8 +156,15 @@ g.compareAllUsers = async(function * compareAllUsers (users) {
       allDels2.push(d)
     })
   }
-  yield users[0].connector.flushAll()
+  yield Y.utils.globalRoom.flushAll()
   yield g.garbageCollectAllUsers(users)
+  yield Y.utils.globalRoom.flushAll()
+  var buffer = Y.utils.globalRoom.buffers
+  for (var name in buffer) {
+    if (buffer[name].length > 0) {
+      debugger // not all ops were transmitted..
+    }
+  }
 
   for (var uid = 0; uid < users.length; uid++) {
     var u = users[uid]
@@ -219,7 +224,7 @@ g.compareAllUsers = async(function * compareAllUsers (users) {
 
 g.createUsers = async(function * createUsers (self, numberOfUsers, database) {
   if (Y.utils.globalRoom.users[0] != null) {
-    yield Y.utils.globalRoom.users[0].flushAll()
+    yield Y.utils.globalRoom.flushAll()
   }
   // destroy old users
   for (var u in Y.utils.globalRoom.users) {
diff --git a/src/Types/Map.spec.js b/src/Types/Map.spec.js
index 7cd44d04e1cd568d36313bcec5a3fb39258ae94a..2aa9e241a262062ae1ff4d0dc468dd5ba888da35 100644
--- a/src/Types/Map.spec.js
+++ b/src/Types/Map.spec.js
@@ -3,7 +3,7 @@
 'use strict'
 
 var Y = require('../SpecHelper.js')
-var numberOfYMapTests = 10
+var numberOfYMapTests = 100
 var repeatMapTeasts = 1
 
 for (let database of databases) {
@@ -16,7 +16,7 @@ for (let database of databases) {
       y2 = this.users[1].root
       y3 = this.users[2].root
       y4 = this.users[3].root
-      flushAll = this.users[0].connector.flushAll
+      flushAll = Y.utils.globalRoom.flushAll
       done()
     }))
     afterEach(async(function * (done) {