Added checks for when there is no data.