cx function code