Remove independent duty and period writes and consolidate in one function. Add line break after period write.