improve tests and docs