refactored connection logic
restricted parallelism to 1 thread