An idea

I think this code might be in the right direction.  I'll explore more after work tonight.