Rewrite the api and document