Refactor interval()