Work on #4.  Has many TODOs yet to be solved.