more efficient demultiplexing