Remove unused elements