Decouple the DOM events from expensive functions.