Use try-with-resources, attempt space optimizations.