Refactored intervals for better testability.