Added a Sleep function to wait for data