Added test code and updated docs.