Remove unused variables and document a little