modify switch code