Removed duplicated assignment
Changed streams to try with resources