Optimizations

* externalize strings
* try-with-resources statement