get the length, the pass in the head and lenght, reduce the time to traverse