added counter for number of valid hops