Updated for Java 8 and Nashorn