WIP: reorganized & simplified as a first pass