remove deprecated stream
Merge branch 'cleanup'
better error handling; improved test coverage