added loop to find three greatest numbers in array