Lots of changes

Too many changes to list, really. Pretty much implemented the entire damn thing.
Code generation now works, which is nice.

TODO:
- graceful key storage
- Better pebble integration
- Optimisation
- Code cleanup