Tidy up of publish code