Make traverse a recursive class method. For clarity!
Cache the completion results, instead of generating them N times.