Refactor according to new api.
Update README.md