Add tests and better docs.