major update

- add gracefull restart
- convert master to an event emitter
- use events for testing instead of logs