Switch to Java 7 and some refactoring