example code for multiplexing