Remove unused elements and properties