Add more comments; add tests.