Remove extraneous elements.