cleanups, separate test function, and update documentation