Refactor interval_expired a bit