Improved docs and tests