There's a lot of boilerplate in the input and output modules that could be generated via a few carefully constructed macros.