Added (debug) logging statements, javadoc for the class and properly implemented Closables (streams)