Updated switch code for https issue