Implement statejoin & fix related bugs

This adds statejoin & a test case

Note that a lot of code was cleanup up / fixed.

Outstanding items that we should fix in the future but perhaps not in this pull request:

- [x] Subtle race condition in sendUpdate with regards to dictionary mutation
- [ ] Subtle timing issue related to using time.After and time.Tick