Updated publish.js psuedocode