Cleanup & CommonJS support

- CommonJS support
- Improve EventEmitter error handling
- Code style updates