Changed data to tmp.data to avoid issues with the function called data