Fix bug where jd=0 is being interpreted as no jd specified.
Assorted fixes.
Work on aspects.
Work on event generation and query logic.
Add some more tests.
Remove cruft.
Add events to API server.