- added some generics, fixed compile warnings
- changed sync protocol slightly