random renaming of things.
Rewrote the whole thing from scratch. The code feels cleaner now. I also updated the example.