Define a set the input algorithm and define other algorithms in terms of it.

Fixes https://www.w3.org/Bugs/Public/show_bug.cgi?id=20926