Functioning version that we've used.  Needs to be cleaned up a bit and documented better