created connect weight function
change connect to connect weight to make simpler