Ported to Groovy