Updated for Java 7