revamping the demultiplexing stuff