Clean up 'gnarly' code.

It's no shorter, but it's at least more readable.
Whoops, documentation tyop.