Handle mux and demux