Using reflection and all sorts of other cool stuff to avoid reliance on
the mode lists, and remove old cruft code.