add doc and tests