Updated sample library
Improved clean up of input streams
no diff
Changed exception management
Fixed some tests