Frodo demuxing

Hi Christian,

Here commits for frodo branch.
Last commit is a missed optimization for demuxer also i requested to push to master.