Reverted more "refactored" code because of bugs dealing with connection
issues. Now it finally works as intended. Testing should have been done
in the first place b4 pushing so as to not break the build!!!