Add comments and simplify a few steps.