remove some unnecessary variables; add back those we need