refactoring and smarter safer expiry