Break up into more cohesive modules.

There's a nasty bug in source/common/errors.c right now that segfaults on
vsnprintf. That needs fixing right away.