made dataReady function like we did in class