remove redundant elements