Remove redundant elements