Re-impl regenerate as groovy script so we can easier optimize with logic as needed and/or add other features
normalize use of ()