better use of streams
some perf inmprovements
better unclosed handling