Refactoring all apis.