Re-wrap to 120 char lines, and break some style rules for readability.
Streamline a bit.
Add some debug info.
Notes on text editor API to help with debugging.