moved data receiving to separate thread