add documentation and tests