replaced GroovyShell implementation with a Closure, which should hopefully be more performant