changed code to java7