use correct version of core lib
use interfaces
move action to separate method
use try-with-resources for closeable
refactor results processing
refactor results processing