Write queue after connect windows

I'll push a commit in the morning with my idea how we can do it.