Fix tests and improve documentation.