rewriting api calls