Added counter for number of tries