How to set up a dynamic loop connection