Updated to run in Java 7