added functionality to check if data recieved is a deta