improved docs and tests