Here I would also prefer not passing in `a` and `b`. I also slightly prefer passing in the entire prefix, not the length.