Organized and Commented

In preparation for rewriting the importer, this is a version with the
same functionality as the master branch, but organized by task "type"
and with some better commenting.