Format reader and use try-with-resources