Refactored waitForUserHistoryToLoad