optimize number of visits