moving endif out of the publish body