Added adaptive expiration algorithm.