Added pre-publish validation. Cleaned up hooks.