Bugfixes. Removal of a redundant gthread.

- Standardized event return codes.
- We no longer run process_events() in another gthread since we're *already* in another gthread.
- We now catch *any* exception and coalesce it into an event-response.
- We now return JSON-encoded exception information.
- Bugfixes.