improved publishing script