Reorg and endOfStream fix

Combined reorg (#115) with endOfStream fix (#114)