First stab (after lots of futzing around)