Refactor to start using custom events, performance improvements
More adjustments to use custom events