Remove globals from event listener and use dependency injection