Tighten the JS logic & getting publishing working