refactored a few things for better understanding and played with the gui
for getting the correct connection order