Broken, but in progress.

Adding comments and more testing and reducing dependencies