add tests; add comments