removes redundant variables