Added conditional checking if there are no targets