Refactored to use a future to wait for the data.