Remove sleep()s from switch.connect(). Why were they there?