Converted to Java 7