Changed switch code