Removes unnecessary variables.