Rewrite README.
Add documentation for API.