Agent refactor

- replaced Observable module with CopyOnWriteObserverSet
- small internal refactor
- test refactor