WIP: Modularizing stuff.  part way through commit.
WIP: Almost done.