Refactor connection creation from where block into setup block.
#11167
+159
−142
where block into setup block.
#11167