add documentation and some test code