made corpus optional for api calls
added function to clear cache