Porting code to MutationObservers