Uses latest Java 7 features

I cleanup up the code using new java 7 features like:
* Diamond operator
* Try-with-resources

I also cleanup up unused variables, non-thrown exceptions (Although it might have broken the API, couldn't tell).