updated apigen script