Still working, but here's ano overly-complicated way of doing this...