improve docs, fix tests