changed so that expiry can be passed in at different times