Updated the api controller