finished cleaning up demultiplexing. cleaning up encoding