Migrated JS code from Rhino to Nashorn