Added logic to only connect to the network if the button is held.