added removeExpired function