now getData function to ease looping