converted to java 7