refactor isExpired