Managed to uncouple the event handling from the rendering