function that receives data