update intersection function ; checking empty array with isEmpty function