Remove duplicate groovy code