WIP

Quick and dirty initial implementation.  Original unit tests run fine, but haven't added anything new yet.  There's duplicated code / etc to be cleaned up once I have tests.