Remove unneeded elements