Use decoder_factory() and a lambda to clean things up a bit.