Add tests and fix the reference manual.