More refactoring on how publish works