Update code to java 7