Add better event and CSS handling in the core