For #28; minor code reorganization and comments.

Nothing major, yet.