improved tests and docs