Remove extraneous elements