Unpublish button and a good refactor