Stubbed code for an attempt at answering the question.  Many lessons learned.