improved publish script