[WIP] Reduce code footprint, move to single-file plugin. Still does not
work - config state not getting passed around consistently.