Uploading for reference.

More work needs to be done, use this version cautiously.