Set function to run whenever DOM updates