Newer, working, and better commented version

Worked all night to get this up.