remove unused variables; add comments