converted to groovy script