remove unecessary elements.