Set up proper, more secure, client-server publishing
Moved publish code into separate file