Rewrite api calls