Refactored. Refined duration code.