Implement Demux
Remove trailing spaces