remove unused elements