modernisation of streams, removed code abstracted to other modules