First commit

A working version with comments mostly as notes to self.